next up previous contents
Next: Decimal to Signed Binary Up: Representations Previous: Conversion between Stream Representations

Conversion to and from decimal

  A human user of a calculator is likely to want to input numbers in decimal, and to view results in decimal. For this reason we include conversions to and from decimal in the calculator.

Converting a decimal input into signed binary (mantissa, exponent) representation is possible, but unfortunately converting from a signed binary input back to decimal is not. This is because it is not necessarily possible to determine even the first digit of the decimal representation of the number without examining a potentially infinite amount of the signed binary input (see section 2.2.1). The solution adopted is to convert only a finite portion of the input stream to decimal. This approximates the result to a known accuracy. Printing exact decimal lower and upper bounds would be a trivial extension.

The operations described here are to and from the signed binary representations only. Conversions between dyadic digit representations and decimal can be performed by going via the signed binary representations (see section 3.7).


Martin Escardo