Internal Representation of Data [ Compiler Library/XL Reference Manual ] MPE/iX 5.0 Documentation
Compiler Library/XL Reference Manual
Internal Representation of Data
This section shows how different data types are internally represented.
Shortint
Range: [-32768,32767] in two bytes
Representation:
Integer
Range: [-2147483648,2147483647] in four bytes (concatenated)
Representation:
Real
Range:
[-3.402823 x 1038 , -1.401298 x 10-45 ] and
0.0 and
1.401298 x 10-45 , 3.402823 x 1038 ] in four bytes (concatenated)
Representation:
For real numbers stored in normalized form, the exponent portion has a
range of [1,254] and the fraction portion has a range of [0,223 -1]. The
sign bit indicates the sign of the fraction portion (0 indicates a
positive value and 1 indicates a negative value).
Real numbers in normalized form have an implied value of 1.0 to the left
of the fraction's most significant bit. Thus, a normalized decimal value
equals
(-1)Sign * 2Exponent-127 * (1.0+Fraction * 2-23 )
and has a range of
(-1)Sign * [1.175494 x 10-38 ,3.402823 x 1038 ]
However, the IEEE Standard P754 allows decimal numbers whose absolute
values are smaller than 1.175494 x 10-38 . This so-called denormalized
number with Exponent equal to zero has the value
(-1)Sign * 2-126 * (0.0 + Fraction * 2-23 )
and has a range of
(-1)Sign * [1.401298 x 10-45 ,1.175494 x 10-38 )
When the significant bit, the exponent, and the fraction are zero, the
decimal value is equal to 0.0.
NaN (not a number) can be encoded in the real number format as follows:
When all the exponent bits are set to 1 and at least one of the
fraction bits is non-zero, there is a NaN regardless of the sign bit.
For example:
Exponent = 255; fraction <> 0
Infinity can also be encoded in the real number format as follows:
When all exponent bits are set to 1 and all of the fraction bits are
set to 0, there is an Infinity: (-1)Sign Infinity. For example:
Exponent = 255; fraction = 0
Longreal
Range:
[-1.797693134862316 x 10308 ,-4.940656458412465 x 10-324 ] and
0.0 and
[4.940656458412465 x 10-324 ,1.797693134862316 x 10308 ] in eight bytes
(concatenated)
Representation:
For longreal numbers stored in normalized form, the exponent portion has
a range of [1,2046] and the fraction portion has a range of [0,252 -1].
The sign bit indicates the sign of the fraction portion (0 indicates a
positive value and 1 indicates a negative value).
Longreal numbers in normalized form have an implied value of 1.0 to the
left of the fraction's most significant bit. Thus, a normalized decimal
value equals the following:
(-1)Sign * 2Exponent-1023 * (1.0+Fraction * 2-52 )
and has a range of
(-1)Sign [2.225073858507201 x 10-308 ,1.797693134862316 x 10308 ]
However, the IEEE Standard P754 allows decimal numbers whose absolute
values are smaller than 2.225073858507201 x 10-308 . Denormalized numbers
with Exponent equal to zero have the value
(-1)Sign * 2-1022 *(0.0 + Fraction * 2-52 )
and has a range of
(-1)Sign * [4.940656458412465 x 10-324 ,2.225073858507201 x 10-308 ]
When the significant bit, the exponent, and the fraction are zero, the
decimal value is equal to 0.0.
NaN (not a number) can be encoded in the longreal number format, as
follows:
When all the exponent bits are set to 1 and at least one of the
fraction bits is non-zero, there is a NaN regardless of the sign bit.
For example:
Exponent = 2047; fraction <> 0
Infinity can also be encoded in the longreal number format as follows:
When all exponent bits are set to 1 and all of the fraction bits are
set to 0, there is an Infinity: (-1)Sign Infinity.
For example:
Exponent = 2047; fraction = 0
NOTE The procedures described in Chapter 4, "Packed-Decimal Procedures,"
use packed-decimal and external-decimal numbers.
MPE/iX 5.0 Documentation