written 7.7 years ago by |
Express (127.125)10 in the IEEE single precision standard of floating point representation:
Step 1: Convert the decimal number to its binary fractional form.
Convert this format is in base2 format For this, first convert 127 in to binary format
127=1111111
Convert 0.125 in to binary format
0.125*2=0.250 0
0.250*2=0.500 0
0.500*2=1.00 1
Binary format of 127.125=1111111.100
Shifting this binary number
1.1111111002 *6 Normalized
1.111111100 is mantissa
2 **6 is exponent
add exponent 127 +6=133
Step 2: Normalize the binary fractional number.
Move the decimal point left or right so that only a single binary
digit "1" is to the left of the binary decimal point. Compensate by
adjusting the exponent in the opposite direction.
1.111111100 times 2*6
Moving the decimal left seven decreases the size of the number; so,
we use an exponent of 6 to compensate and keep the number the same size.
Step 3: Convert the exponent to 8-bit excess-127 notation
Add 127 to the exponent and convert it to 8-bit binary:
6+ 127 = 133--> 10000101
Step 4: Convert the mantissa/significand to "hidden bit" format.
Since every binary floating-point number (except zero!) is normalized
with "1." at the start, there is no need to store that leftmost "1".
Remove the leading "1." from the mantissa/significand:
1.111111100--> 111111100
Step 5: Write down the 1+8+23 = 32 bits.
127.125 is positive - the sign bit is zero: 0
The next eight bits are the exponent: 10000101
The next 23 bits are the mantissa: 11111110000000000000000
Binary result (32 bits): 01000010111111110000000000000000
Express (127.125)10 in the IEEE double precision standard of floating point representation.
Step 1: Convert the decimal number to its binary fractional form.
Convert this format is in base2 format For this, first convert 127 in to binary format
127=1111111
Convert 0.125 in to binary format
0.125*2=0.250 0
0.250*2=0.500 0
0.500*2=1.00 1
Binary format of 127.125=1111111.100
Shifting this binary number
1.1111111002 *6 Normalized
1.111111100 is mantissa
2 **6 is exponent
add exponent 1023+6=1029
Step 2: Normalize the binary fractional number.
Move the decimal point left or right so that only a single binary
digit "1" is to the left of the binary decimal point. Compensate by
adjusting the exponent in the opposite direction.
1.111111100 times 2*6
Moving the decimal left seven decreases the size of the number; so,
we use an exponent of 6 to compensate and keep the number the same size.
Step 3: Convert the exponent to 8-bit excess-127 notation
Add 1023 to the exponent and convert it to 8-bit binary:
6+1023= 1029--> 10000000101
Step 4: Convert the mantissa/significand to "hidden bit" format.
Since every binary floating-point number (except zero!) is normalized
with "1." at the start, there is no need to store that leftmost "1".
Remove the leading "1." from the mantissa/significand:
1.111111100--> 111111100
Step 5: Write down the 1+11+52 = 64bits.
127.125 is positive - the sign bit is zero: 0
The next 11 bits are the exponent: 111111100
The next 23 bits are the mantissa: 111111100000000000000000000000000000000000000000000000
Binary result (64 bits): 0111111100 111111100000000000000000000000000000000000000000000000