[next] [prev] [prev-tail] [tail] [up]

#### 8.2.5 Floating point types

Floating point type sizes and mapping vary from one processor to another. Except for the Intel 80x86 architecture, the extended type maps to the IEEE double type if a hardware floating point coprocessor is present.

Floating point types have a storage binary format divided into three distinct fields : the mantissa, the exponent and the sign bit which stores the sign of the floating point value.

##### Single

The single type occupies 4 bytes of storage space, and its memory structure is the same as the IEEE-754 single type. This type is the only type which is guaranteed to be available on all platforms (either emulated via software or directly via hardware).

The memory format of the single format looks like what is shown in figure (8.1).

Figure 8.1: The single format

##### Double

The double type occupies 8 bytes of storage space, and its memory structure is the same as the IEEE-754 double type.

The memory format of the double format looks like like what is shown in figure (8.2).

Figure 8.2: The double format

On processors which do not support co-processor operations (and which have the {$E+} switch), the double type does not exist.

##### Extended

For Intel 80x86 processors, the extended type has takes up 10 bytes of memory space. For more information on the extended type consult the Intel Programmer’s reference.

For all other processors which support floating point operations, the extended type is a nickname for the type which supports the most precision, this is usually the double type. On processors which do not support co-processor operations (and which have the {$E+} switch), the extended type usually maps to the single type.

##### Comp

For Intel 80x86 processors, the comp type contains a 63-bit integral value, and a sign bit (in the MSB position). The comp type uses 8 bytes of storage space.

On other processors, the comp type is not supported.

##### Real

Contrary to Turbo Pascal, where the real type had a special internal format, under Free Pascal the real type simply maps to one of the other real types. It maps to the double type on processors which support floating point operations, while it maps to the single type on processors which do not support floating point operations in hardware. See table (8.2) for more information on this.

Table 8.2: Processor mapping of real type

Processor | Real type mapping

Intel 80x86 | double
Motorola 680x0 (with {$E-} switch) | double
Motorola 680x0 (with {$E+} switch) | single

[next] [prev] [prev-tail] [front] [up]