next up previous contents
Next: Signed decimal fractions to Up: Signed Binary to Decimal Previous: Signed binary integers to

Signed binary fractions to signed decimal fractions

Conversion to signed decimal is performed as follows. Given the signed binary input u, we compute the decimal result $0.U_{-1}U_{-2}U_{-3}
\dots $ as:

We implement this using a signed binary stream, representing a number in the interval [-1,1]. This means we cannot represent the value ten to perform multiplication by ten using the signed binary stream multiplication algorithm. It is possible, however, to multiply instead by the value 10/24, which is in the interval [-1,1] and can be represented as a signed binary stream. This produces the correct result provided we interpret the output as being multiplied by 24.

The algorithm for converting from signed binary into signed decimal is therefore as follows:

\begin{displaymath}
\begin{array}
{l}
\mathrm{sbDec\_s}(x) = (8\!\cdot\!a + 4\!\...
 ...::c::d::x') = x \times (1::0::1::\overrightarrow{0})\end{array}\end{displaymath}

In fact the output stream is in fact not true signed decimal, because we can in fact get the digits -10 and 10 appearing at the first digit if there is an overflow. However this is not a problem because we can easily check these digits in the first output digit when the conversion is complete, and handle the overflow appropriately if necessary.


next up previous contents
Next: Signed decimal fractions to Up: Signed Binary to Decimal Previous: Signed binary integers to
Martin Escardo
5/11/2000