[fpc-pascal] Currency and ABS(-674.59)

Zaher Dirkey parmaja at gmail.com
Thu Mar 8 08:59:29 CET 2012


On Thu, Mar 8, 2012 at 3:28 AM, Marcos Douglas <md at delfire.net> wrote:

> Integer math... what did you mean?


Integer math =  Currency or in  DB numeric(18, 4)

in Firebird
create domain AMOUNT as numeric(18,4);

On Thu, Mar 8, 2012 at 12:43 AM, Graeme Geldenhuys
<graemeg.lists at gmail.com>wrote:

> This is why our accounting app uses Integer math (and when stored in the
> database). Only when amounts are displayed to the user, do we convert the
> integer value to currency. This greatly reduced our calculation and
> rounding problems.
>

Yes i do that from more than 10 years, Float/Extended have problem when
rounding it and sum that rounding, it is only good in Science not
Accounting.

Currency for me is  Int64 (* int of 10000 or binary shifted) it is more
stable and not lose any cent when sum the balances, until i passed it to
ABS, ABS convert it to float and return back to Currency, that my problem
here.

In the future i like to have new kind of Currency (integer) but more extend
(* 1000000 for example).

Best Regards
Zaher Dirkey
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freepascal.org/pipermail/fpc-pascal/attachments/20120308/8389c6e2/attachment.html>


More information about the fpc-pascal mailing list