Encoding


How to encode a binary floating-point number:

Encoding a rational number in floating-point is basically the reverse of the above procedure.

To encode the value +1 1/8 for example, follow the steps below.

Express the value in binary with radix: 1.001
Note that the mantissa pattern required is 1001 (without the radix.)
Note also that the radix should move 1 position to the right of the mantissa assumed to be .1001 so the value of the exponent should be +1 expressed in excess 4 notation, i.e., 101


Finally the sign bit should indicate a + so it is 0.

Putting all three components together, the resulting pattern is 0 101 1001.