0% found this document useful (0 votes)
106 views

Excess 64 and IEEE 754 Format

Firstm,most computers use IEE 754, not excess 64 format. IBM System/360 computers use Base-16 Excess 64 format. If you're running a standard desktop computer chances are your computer uses IEEE 754.

Uploaded by

Ciel Simeon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
106 views

Excess 64 and IEEE 754 Format

Firstm,most computers use IEE 754, not excess 64 format. IBM System/360 computers use Base-16 Excess 64 format. If you're running a standard desktop computer chances are your computer uses IEEE 754.

Uploaded by

Ciel Simeon
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 9

Excess 64 and IEEE 754

Format

Firstm,most computers use IEE 754, not excess 64 format. IBM System/360
computers use Base-16 Excess 64 format. If you're running a standard desktop
computer chances are your computer uses IEEE 754.

In Base-16 Excess 64 - for single precision numbers, like floats - we use 4


bytes, or 32 bits. The first bit is the sign bit, followed by a 7 bit exponent,
followed by the mantissa (or the significand).

Decimal Conversion to Binary

1) Get the sign bit.


2.25 is positive so it's 0.

2) Write the number in binary.


2.25 = 10.01B

3) Move the radix (the decimal) in powers of 16 (4 bits - nibbles) until


the number is less than 1 and greater than .03125 (or .00001B). In other words,
we want the radix as close to the first 1 as possible, but the number has to be less
than 1. When the number is stored like this it is said to be normalized.*
10.01 = .001001 * 16^ 1

4) Remove the decimal and add zeros to the end of the number until there are 24
bits. This is the mantissa.
0010 0100 0000 0000 0000 0000

5) Since this is excess 64 (the bias is 64), we add the exponent from
step 3
to 64 and convert that to binary, which will be the exponent. In this case, the
exponent of 16 was
64 + 1 = 65 = 1000001B

Decimal Conversion to Binary

6) Now we put it all together. Sign bit, then exponent, then mantissa.
0 1000001 001001000000000000000000
sem
or in hex:
0x41 0x24 0x00 0x00

*Step 3 is a bit hard to follow, so here are more examples. If the number is .
03125 (.00001B) we would move the radix right one nibble, so it would become .
1 * 16^-1. If the number was 37.5 (100101.1B) it would become .001001011 *
16^2

As

I mentioned in the beginning, real numbers are


usually stored in IEEE 754, not excess 64. In IEEE
754 - for single precision, like floats - 1 bit is used
for the sign bit, 8 bits are used for the exponent,
and the last 23 bits are used for the mantissa.
Also, in IEEE 754 the number is said to be
normalized when it is between 1 and 2, the bias is
127 (as opposed to excess 64 where the bias is
64), and it is base-2.

Let's convert 17.125

1) Find the sign bit.


17.125 is positive so the sign bit is 0.

2) Write the number in binary.


17.125 = 10001.001B

3) Move the radix (the decimal) in powers of 2 (1 bit) until the


number is between 1 and 2. When the number is stored like this it is
said to be normalized.*
10001.001 = 1.0001001 * 2^ 4

4) The number is normalized (it is between 1 and 2), so the leading 0


is dropped. Only the floating portion is retained. Remove the decimal
point and add zeros to the right until there are 23 bits. This is the
mantissa.
0001 0010 0000 0000 0000 000

Let's convert 17.125

5) Add the exponent from step 3 (2^ 4 so the exponent is 4) to the bias, 127,
and convert it to binary. This is the exponent.
127 + 4 = 131 = 10000011B

6) Now just put it all together. Sign bit, then exponent, then mantissa.
0 10000011 00010010000000000000000
sem
or in hex:
0x41 0x89 0x00 0x00

*Step 3 is hard to follow, so here are two more examples of normailizing numbers:
12.5 = 1100.1B = 1.1001 * 2^3.
.125 = .001B = 1 * 2^-3

Something

to remember is that in memory


numbers are stored low order first, then high
order, so if you have a look at your memory, you
will see the numbers in reverse.

Here's a C++ code snippet to show that it works:


typedef unsigned char BYTE;
float fl = 17.125;
BYTE* pFl = (BYTE*)&fl;
for (int i= sizeof(float) - 1; i >= 0; i--)
cout << hex << "0x" << (unsigned)pFl[i] << ' ';
cout << endl;
outputs 0x41 0x89 0x00 0x00

You might also like