Accuracy problem using AsCurrency and Firebird

Forum related to version 6.5.1 (alpha) and 6.6.x (beta) of ZeosLib's DBOs

Moderators: gto, cipto_kh, EgonHugeist

Post Reply
peteoshea
Fresh Boarder
Fresh Boarder
Posts: 3
Joined: 25.10.2006, 11:15

Accuracy problem using AsCurrency and Firebird

Post 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
Post Reply