TExtendedHelper = record helper for Extended
typedef void *TExtendedHelper;
Provides support for performing low-level operations on Extended precision floating-point values.
On 64-bit Windows and ARM platform, the Extended type is an alias for Double. Double numbers are represented in 64 bits: 1 bit for Sign, 11 for Exponent, and 52 for Fraction. The bias is 1023. See Internal Representation of Extended Type for more information.
Note: On 32-bit Windows, TExtendedHelper offers the support that TExtended80Rec previously offered. If your program still manipulates 80-bit extended floating-point type on all platforms, the program can use the TExtended80Rec type.
var aNumber: Extended; begin aNumber := 28; Writeln(Format('Number: %f', [aNumber])) ; Writeln(Format('Exponent: %d', [aNumber.Exp])); Writeln(Format('Fraction: %x', [aNumber.Frac])); Writeln(Format('Mantissa: %x', [aNumber.Mantissa])); ReadLn;
Console output when SizeOf(Extended) is 10 bytes:
Number: 28.00 Exponent: 16387 Fraction: E000000000000000 Mantissa: E000000000000000
Console output when SizeOf(Extended) is 8 bytes:
Number: 28.00 Exponent: 1027 Fraction: C000000000000 Mantissa: 1C000000000000
The number 28 is represented in binary as 11100. After the normalization, it is 1.1100 * 2^4.
The Sign is 0 (False).
The exponent is 4. If the size of Extended is 10 bytes (for example, on the 32-bit Windows platform), Exponent is represented in extended precision as 16383 (the bias) + 4 = 16387. 16387 is 100000000000011 in binary.
If the size of Extended is 10 bytes, the Fraction contains all bits of the Mantissa, also known as the significand, and is equal to 11100. The Fraction is represented in 64 bits, so we fill the 11100 sequence with zeros up to 64 digits:
11100000000000000000000000000000000000000000000000000 ($E000000000000000 in hexadecimal).
If the size of Extended is 8 bytes, the Fraction is formed from only the bits after the decimal mark in binary form and is equal to 1100, that is, the leading bit value of 1 is omitted. On such platforms, Fraction is represented in 52 bits, so we fill the 1100 sequence with zeros up to 52 digits:
The Mantissa, also known as the significand, contains all precision bits of the number 11100.
If the size of Extended is 10 bytes, the Mantissa is represented in 64 bits, so we fill the 11100 sequence with zeros up to 64 digits:
If the size of Extended is 8 bytes , the Mantissa is represented in 53 bits, so we complete 11100 sequence with zeros up to 53 digits:
- Floating point precision control (Object Pascal for x64)
- Internal Representation of Extended Type