# Internal Representation

## S/390 Floating Point

S | Exponent | Fraction |

0 | 1-7 | 8 - end |

The first bit indicates the sign of the floating point number.
For short and long floating point numbers, the next 7 bits
represent the exponent; the remaining bits represent the fraction
as a binary number. The exponent value is increased by 64; thus exponents
in the range -64 to +63 can be represented. A short floating point value
is 4 bytes long; a long floating point value is 8 bytes long.
An extended floating point value consists of two 8 bytes values:
the sign and exponent from the high order part are used for both;
the fraction is the fraction from the high order part followed by the
fraction from the low orderpart.

For example, the value 2.1 is represented as a short floating value
as

x'41219999' which is x'219999'/x'1000000'
or roughly 0.131249964
which is multiplied by
16 raised to the power 65-64 = 1
to give roughly 2.09999943.
## IEEE Floating Point

S | Exponent | Fraction |

0 | 1-8 | 9 - end |

Again the first bit indicates the sign. The next 8 bits represent the exponent
as a binary number. The exponent value is offset by 127; exponent values in
the range -127 to +127 can be represented. Note that the exponent value 255
which would be equivalent to +128 is reserved for special values such as
NaN (Not a Number). The remaining bits represent the fraction as a normalized
value with the leading 1 removed.
For example, the value 2.1 is represented as a short floating value as

x'40066666' which is 1 + x'066666'/x'800000',
roughly 1.049999952,
which is multiplied by
2 raised to the power 128-7 = 1
to give roughly 2.099999904.
See
"IBM S/390 Support for IEEE Floating Point"