Correctly rounded conversions are easy, in principle. Any positive binary floating-point value
can also be expressed as a fixed-point number of the form
, where the i bits are the integer part and the f bits are the fraction part. If the exponent e is near the limits of the exponent range, the integer part could be very large or the fraction part very small, but there is just a p-bit-wide sequence of nonzero bits, limited by the precision of the floating-point format.
Conversion of the fraction part to decimal is just a matter of successively multiplying the binary fraction by ten; the decimal fraction digits appear from left to right. Conversion of the integer part proceeds by successively dividing by 10; the integer digits appear from right to left.
[Contents]
[Previous]
[Next]
Click the icon to mail questions or corrections about this material to Taligent personnel.