Decimal to Binary Floating-Point Conversion

​
base-10 number
54.75
bits in exponent
3
bits in mantissa
4
sign ofnumber
sign ofexponent
exponent
mantissa
0
0
101
1011
This Demonstration shows the conversion of a decimal number (base 10) to a floating-point binary format.

Details

The total number of bits used for the representation is equal to
numberofbitsforthemantissa+
​
​
numberofbitsfortheexponent+
​
​
onebitforthesignofthenumber+
​
​
onebitforthesignoftheexponent
As an example, how would 54.75 be represented when four bits are used for the mantissa and three bits are used for the exponent?
54.75
10
=
110110.11
2
=
1.1011011
2
×
5
2
=
1.1011011
2
×
101
2
2
Both the number and the exponent are positive.
As the number is normalized to lie between 1 and 2 (the interval being half-closed at the bottom and half-open at the top), the leading binary digit is always 1. So we do not actually use it in the representation of the mantissa. Hence the mantissa bits are 1011. Moreover the exponent bits are 101, the sign of the number bit is 0, and the sign of the exponent bit is 0.
Therefore the representation is
001011011
.

External Links

Binary (Wolfram MathWorld)
Counting in Binary
Structure of Binary Numbers

Permanent Citation

Vincent Shatlock, Autar Kaw
​
​"Decimal to Binary Floating-Point Conversion"​
​http://demonstrations.wolfram.com/DecimalToBinaryFloatingPointConversion/​
​Wolfram Demonstrations Project​
​Published: May 23, 2011