Subject Re: [firebird-support] NUMERIC(18,6) calculation problem
Author Ivan Prenosil
> Daniel Rail wrote:
>> One way would be to create a UDF to make those calculations. The
>> other would be to cast your values as DOUBLE PRECISION values before
>> the multiplication, but you might loose some accuracy in the decimals,
>>
>>
>
> Can you please tell me what would be the accuracy in the decimals I can
> loose? (using
>
> DOUBLE PRECISION)
> Will it at least be accurate at 6 decimal places?
> Since this is for currency values if I get an accuracy of 6 decimal places at least, its fine for me.

Both Int64 and Double precision are 64 bit, but double is less precise because
some bits are used for exponent. With UDF written in Delphi you could
internally use Extended which can hold 19-20 significant digits.

Perhaps the precision is not much important for you if you want
to round 6 decimal places out of 12 anyway ?

Ivan