From Lazarus wiki
Jump to: navigation, search

Deutsch (de) English (en) 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.

navigation bar: data types
simple data types

boolean byte cardinal char currency extended int64 integer longint pointer real shortint smallint word

complex data types

array class object record set string shortstring