From: Sean O'Dell Date: 2004-05-13T02:27:38+09:00 Subject: Re: Major Addition Bug? On Wednesday 12 May 2004 10:18, Dave Thomas wrote: > On May 12, 2004, at 12:07, Sean O'Dell wrote: > > On Wednesday 12 May 2004 09:53, ts wrote: > >>>>>>> "S" == Sean O'Dell writes: > >> > >> S> raise "false" if ((625.91 + 900.00 + 22.00) != 1547.91) > > > > How old is this bug? When is it > > getting fixed? > > It's about 40 years old, and unlikely to be fixed. Floating point > numbers are not represented exactly inside computers, and so floating > point comparisons are routinely deprecated in books on programming. > Certain values cannot ever be expressed in floating point > representation. > > If you want exact, fractional, math, you should probably use the > 'rational' library and investigate 'mathn'. Funny though, if I set a variable to 1547.91 exactly, it is represented just fine. A value during the arithmetic must be a value which can't be represented. I had to massage my floating point math in C/C++ a lot many years ago, but I always assumed it was a flaw in the MS compiler, and once I got in the habit of doing it, I forgot about it. Thanks for the info. I'm far less bitter now about having to round the numbers for comparison. =) Sean O'Dell