On Jan 1, 2008, at 10:23 PM, Lee Jenkins wrote:


I have a method of a class such as:

function TMyObject.Test(ACurrency: Currency)
begin
 // do some stuff
end;

Now, I'll call this method like:

MyObject.Test(0.23);

The problem is that inside the Test method, the current type is converted to an integer like 2300.

Anyone see anything like this?

I changed it to use Double type and it works fine.

Windows, Lazarus 0.9.24, FPC 2.2.0


In many languages or frameworks Currency are Integer (64bits) in order to have fixed point numbers to minimizes rounding errors in monetary calculations.

For example 150.95 will be stored as 15095.

For FreePascal, I don't know how it is really managed behing the scene, but in many languages or tools it is like that (D, sqlite, MS SQL...).





--
Damien Gerard
[EMAIL PROTECTED]

People who used magic without knowing what they were doing usually came to a sticky end. All over the entire room, sometimes.
    -- (Terry Pratchett, Moving Pictures)



_________________________________________________________________
    To unsubscribe: mail [EMAIL PROTECTED] with
               "unsubscribe" as the Subject
  archives at http://www.lazarus.freepascal.org/mailarchives

Reply via email to