3.1.2 Real types

Free Pascal uses the math coprocessor (or emulation) for all its floating-point calculations. The Real native type is processor dependent, but it is either a Single or a Double. Only the IEEE floating point types are supported, and these depend on the target processor and emulation options. The true Turbo Pascal compatible types are listed in table (3.5).


Table 3.5: Supported Real types

Type Range Significant digits Size




Real platform dependant ??? 4 or 8
Single 1.5E-45 .. 3.4E38 7–8 4
Double 5.0E-324 .. 1.7E308 15–16 8
Extended 1.9E-4932 .. 1.1E4932 19–20 10
Comp -2E64+1 .. 2E63-1 19–20 8
Currency-922337203685477.5808 .. 922337203685477.5807 19–20 8

The Comp type is, in effect, a 64-bit integer and is not available on all target platforms. To get more information on the supported types for each platform, refer to the Programmer’s Guide.

The currency type is a fixed-point real data type which is internally used as an 64-bit integer type (automatically scaled with a factor 10000), this minimizes rounding errors. This type should be used with care: when used in expressions using e.g. multiplication, the evaluation of the expression may go wrong (losing precision) if intermediate results fall outside the currency range.

Note that not all float types are available on all platforms. The single float type is the only one guaranteed to be available on all platforms that have floating point support (so e.g. AVR does not have it). The double type is available on all platforms with coprocessor, and the extended type is available on all Intel x86 processors, except on the Windows 64-bit platform. More details on availability can be found in the Programmer’s Guide.