I wrote before on the mailing list ([EMAIL PROTECTED]) about the importance of
precision when manipulating money values. Money values are currently handled
with floating point values stored in base 2.
I'm trying to produce a sample of how this internal design might result in
wrong results. I didn't found one yet with money values, but here is one
with date values :

>> d: now
== 19-Feb-2000/18:43:56+1:00
>> d/time/second: 29.456
== 18:43:29.455999999

This test was running on the Win32 platform.

As you can see, the output is not the same as the input. This is due to the
fact that the  input (29.456) is converted from decimal to binary for
storage, then from binary to decimal for output. One thing that too many
programmers ignore is that conversion of fractionnal numbers may result in
losing precision when converting from decimal to binary or from binary to
decimal.

For date value, I don't care because I don't plan to use so small values of
time. But I repeat that precision is the most important thing when dealing
with money  values.

Olivier Mengué

Reply via email to