Currency
Deutsch · English · Français · Suomi · Русский
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
- function
CurrToStr - function
FormatCurr - function
StrToCurr
From the Free Pascal wiki, page "Currency", as it stood on 2022-05-26 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.
Talk about this page
Nobody has opened a bench for this page yet. Sign in to open one.
