[fpc-pascal] Freepascal Floating Point Issue
el es
el.es.cr at gmail.com
Thu Aug 24 15:02:31 CEST 2017
On 24/08/17 13:26, Sven Barth via fpc-pascal wrote:
[...]
>
> Note: FPC (and Delphi) has a single fixed point type which is
> Currency. AFAIK it uses four digits after the comma and 28 in front
> of it.
>
> Regards, Sven
>
There was a project I remember, that I was told, for some e.g. tax purposes,
4 digits after the decimal point are not enough to round them properly...
That is because, the calculation of e.g. VAT has to work out both ways (total=net+VAT and
has to work out in every way, including when a bigger package is split into smaller units)
and 4 decimal digits are not always enough to ensure this (and the program had to work
internationally with all the different tax rules too) for arbitrarily large quantities, prices and tax bands.
I don't remember the exact details (it long time ago and couple of workplaces ago), of what they did,
but the team developing it (in D7) was pretty stressed...
-l.
More information about the fpc-pascal
mailing list