Name

Currency Type

Syntax

type Currency;

Description

The Currency type is a 64-bit fixed-point type, with four places after the decimal point. The Currency type uses the floating-point processor, treating the Currency value as an integer. Input and output using the Currency type imposes the four-decimal place convention, and computation using Currency automatically adjusts the value by 10,000 to account for the implicit decimal places.

Tips and Tricks

  • To use the full 64-bit precision of the Currency type, the floating-point control word must be set to extended precision. Some Microsoft and other DLLs change the floating-point control word to double or single precision, thereby reducing the Currency type to 54 or fewer bits.

  • Delphi’s I/O and the formatting routines in the SysUtils unit do not support the full range of the Currency type. Values near the limits of the Currency type are printed with less precision than is actually stored in the Currency variable. Most applications will not encounter this limitation.

See Also

Extended Type, Int64 Type, Set8087CW Procedure

Get Delphi in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.