From: Marc-Andre Lafortune Date: 2010-04-21T00:04:49+09:00 Subject: [ruby-core:29663] Re: [Feature #1408] 0.1.to_r not equal to (1/10) Hi, On Tue, Apr 20, 2010 at 7:03 AM, tadayoshi funaba wrote: > a.rationalize == a #=> false Clearly, a_float.rationalize.to_f.should == a_float If it doesn't round trip, it is a problem and should be addressed. It does round trip, at least on my system: $ rubydev -v ruby 1.9.2dev (2010-04-07 trunk 27251) [x86_64-darwin10.3.0] or ruby 1.9.2dev (2010-04-20 trunk 27420) [x86_64-darwin10.3.0] $ irbdev a = 0.5337486539516013 b = 0.5337486539516012 a.rationalize == a # => true b.rationalize == b # => true 100_000.times.all?{ f = rand; f.rationalize == f} # => true What version of Ruby are you using, and on what system? BTW, a.rationalize == (7742439284/14505777629) and b.rationalize == (6224985158/11662765071). (at least on my machine!)