Page 1 of 1

Accuracy problem using AsCurrency and Firebird

Posted: 22.01.2008, 11:15
by peteoshea
I am using Firebird 2.0.3, Turbo Delphi and Zeos 6.6.1 (I have also tried Zeos 6.6.2 and the problem is still there).

When I try to store some values into a field in Firebird of type NUMERIC(15,4) then they are not stored correctly.

One value that seems to get saved incorrectly is 1.56. If you try and store this value in a NUMERIC(15,4) field like this:

Code: Select all

    ParamByName('VAL').AsCurrency := 1.56;
Then the value actually stored in the field will be 1.5599.

If, however, you save the value as a float:

Code: Select all

    ParamByName('VAL').AsFloat := 1.56;
Then the correct value will be stored in the field, 1.5600.

I am not sure where to look to resolve this problem? Could someone please help shed some light.

Thanks
Peter