From: Tomasz Wegrzanowski Date: 2010-07-21T22:52:32+09:00 Subject: [ruby-core:31404] [Bug #3589] Converting Bignums to Float for equality checks is wrong Issue #3589 has been updated by Tomasz Wegrzanowski. This isn't how Floats and other numbers work. No numerical type can represent every real number, and many operations are implicitly followed by rounding to nearest representable value. But once rounded a number corresponds to a precise mathematical value - and comparisons never need to involve any further rounding. Integer 10 means exactly 10, not everything that would end up as 10 if rounded. 10 == 10.2 #=> false And r1800 is wrong. 100000000000000000000000.to_f is a precise number 99999999999999991611392, and it doesn't equal 100000000000000000000000 any more than 10.2.to_i equals 10.2. ---------------------------------------- http://redmine.ruby-lang.org/issues/show/3589 ---------------------------------------- http://redmine.ruby-lang.org