Subject Re: [firebird-support] Linked Table and double precision
Author Mark Rotteveel
On 2019-10-30 11:58, 'Check_Mail' check_mail@...
[firebird-support] wrote:
> Hello,
>
> I use Microsoft Access as frontend, firebird 3 superserver as backand.
> Now, there a many linked tables in access over firebird odbc, some of
> the colums are in double precision format.
>
> Now, I don't know why, in a Report I calculate the VAT, in my case:
>
> 279.578,50 * 0,19
>
> If I calculate it wit a calculator, I get 53.119,915
>
> The frontend calculates me 53.119,143 and in result, the final sum is
> wrong. 915 should 92, but 914 will be 91.

If your frontend calculator gives you 53.119,143 then you are probably
having a propagated compound calculation error caused by the use of
double precision (or possibly early rounding).

In any case, you shouldn't use double precision for monetary values.
Double precision is imprecise by its nature. Use a NUMERIC or DECIMAL
instead, and if you use dialect 1, switch to dialect 3, because in
dialect 1NUMERIC/DECIMAL with a precision over 9 are effectively double
precision).

Mark