From Free Pascal wiki
Revision as of 10:52, 26 May 2022 by Trev (talk | contribs) (Replace deprecated enclose attributes)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

Deutsch (de) English (en) suomi (fi) français (fr) русский (ru)

The Currency type is a real data type with 4 digits to the right of the decimal point and a range of -922337203685477.5808 to 922337203685477.5807 . The purpose of the Currency data type is to give arithmetic results that exactly correspond to decimal calculations on the input values.

Real values are normally stored in the binary number system internally, and calculations are performed in the CPU in binary arithmetic. Since humans desire input and output numbers to be in decimal number format, there must be a conversion made between external decimal numbers and their binary internal representation. As a result of the conversion to/from binary numbers and the calculations being done in binary arithmetic, the results of normal real arithmetic can differ from a decimal arithmetic calculation. This discrepancy is not critical in many applications, but financial applications want their arithmetic operations to match a decimal arithmetic calculation. The currency data type is designed to give arithmetic results corresponding to decimal arithmetic on the real values given.

See also

navigation bar: data types
simple data types

boolean byte cardinal char currency double dword extended int8 int16 int32 int64 integer longint real shortint single smallint pointer qword word

complex data types

array class object record set string shortstring