Decimal to Binary Floating-Point Conversion
Requires a Wolfram Notebook System
Interact on desktop, mobile and cloud with the free Wolfram Player or other Wolfram Language products.
This Demonstration shows the conversion of a decimal number (base 10) to a floating-point binary format.
Contributed by: Vincent Shatlock and Autar Kaw (May 2011)
Open content licensed under CC BY-NC-SA
Snapshots
Details
The total number of bits used for the representation is equal to
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?
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 .
Permanent Citation