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.
|Simple Data Types||Boolean | Byte | Cardinal | Char | Currency | Extended | Int64 | Integer | Longint | Pointer | Real | Shortint | Smallint | Word|
|Complex Data Types||Array | Class | Record | Set | String | ShortString|