Currency conversions (delphi bug or not ?)

2006-03-08 04:03:12 PM
Hy all
The problem orriginates in a DB (oracle) application where there is
NUMBER field that I try to read
"goodsModel.price := query.FieldAsCurrency
where price id of type Currency, an
[i:eda889c689]FieldAsCurrency[/i:eda889c689] calls directly
from [i:eda889c689]TQuery[/i:eda889c689], and returns
The problem is that for numbers greater tha
[b:eda889c689]33333333333332 [/b:eda889c689](that's 14 digits), th
returned value is somehow aproximative. (instead o
[b:eda889c689]33333333333333 [/b:eda889c689]I ge
Why? :?:
The strange part is I made the test procedure below
procedure TestCurr()
currTmp : currency
doubleTmp : double
currTmp := 33333333333333.0000
doubleTmp := currTmp
currTmp := doubleTmp
MessageDlg(currtostr(currtmp), mtCustom, [mbOK],0)
If I call this in my application, the returned value i
[b:eda889c689]33333333333332.9984[/b:eda889c689], but if I make
simple test application and call this same procedure I ge
[b:eda889c689]33333333333333[/b:eda889c689]. As fas as I could check
both applications have the same project opptions.
The problem appeares to be related to some type conversions, but i
the orriginal case there was no type conversion, and btw, currenc
should support 20 digits precission for positive numbers..... so..
I wander if there can be a compilation flag or something, to avoi
this situation (as long as my test application works ok), but in th
GUI part there is no settings difference between the test and th
orriginal application
Any ideea is appreciated