A decimal type with 4 decimal points used for financial values System unit
  type Currency;
The Currency type is designed for use in financial applications. It supports 4 decimal places with at least 53 bits precision*.
Decimal places beyond the supported 4 are rounded up or down, as appropriate. See the sample code for an example.
* Depends on the processor floating point precision.

Very large Currency values will lose precision with some of the StrUtils functions.
Related commands
CurrToStr Convert a currency value to a string
CurrToStrF Convert a currency value to a string with formatting
Double A floating point type supporting about 15 digits of precision
Extended The floating point type with the highest capacity and precision
PCurrency Pointer to a Currency value
Single The smallest capacity and precision floating point type
StrToCurr Convert a number string into a currency value
 Author links

 Download this web site as a Windows program.

Example code : Rounding up and down currency amounts
  account1, account2, account3 : Currency;
  account1 := 123.456749;   // Too many decimals - will be rounded down
  account2 := 123.456750;   // Too many decimals - will be rounded up
  account3 := account1 + account2;

  ShowMessage('Account1 = '+CurrToStr(account1));
  ShowMessage('Account2 = '+CurrToStr(account2));
  ShowMessage('Account3 = '+CurrToStr(account3));
Show full unit code
   Account1 = 123.4567
   Account2 = 123.4568
   Account3 = 246.9135
Delphi Programming Neil Moffatt 2002 - 2020. All rights reserved.  |  Home Page