From: Jamis Buck Date: 2004-05-13T02:26:21+09:00 Subject: Re: Major Addition Bug? 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? > > Sean O'Dell > > . > For what its worth, it appears (on my box, at least) that perl and python both give the same result. It is not a Ruby bug, but rather a problem with floating point round off. -- Jamis Buck jgb3@email.byu.edu http://www.jamisbuck.org/jamis ruby -h | ruby -e 'a=[];readlines.join.scan(/-(.)\[e|Kk(\S*)|le.l(..)e|#!(\S*)/) {|r| a << r.compact.first };puts "\n>#{a.join(%q/ /)}<\n\n"'