From: "Ara.T.Howard" Date: 2004-05-13T02:43:56+09:00 Subject: Re: Major Addition Bug? On Thu, 13 May 2004, 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) > > > > Well, this is well known > > Well known? I had no idea this bug existed until I wrote a line of code that > double-checked the arithmetic from a different app. I have code all over > doing simple arithmetic like this. Ruby can't add 3 simple numbers? I don't > mean to be disproportionately negative, but that shakes my faith more than a > little. It's just simple arithmetic. How old is this bug? When is it > getting fixed? i'd say no time soon unless ruby decides to implement it's own floating point hardware emulator: ~ > cat a.c #include #include int main (argc, argv, env) int argc; char **argv; char **env; { float total = 1547.91; float a = 625.91; float b = 900.00; float c = 22.00; float sum; sum = a + b + c; fprintf (stdout, "total <%f>\n", total); fprintf (stdout, "sum <%f>\n", sum); return 0; } ~ > gcc a.c -o a ~ > ./a total <1547.910034> sum <1547.909912> -a -- =============================================================================== | EMAIL :: Ara [dot] T [dot] Howard [at] noaa [dot] gov | PHONE :: 303.497.6469 | ADDRESS :: E/GC2 325 Broadway, Boulder, CO 80305-3328 | URL :: http://www.ngdc.noaa.gov/stp/ | TRY :: for l in ruby perl;do $l -e "print \"\x3a\x2d\x29\x0a\"";done ===============================================================================