From: tadayoshi funaba Date: 2010-04-20T20:03:15+09:00 Subject: [ruby-core:29652] [Feature #1408] 0.1.to_r not equal to (1/10) Issue #1408 has been updated by tadayoshi funaba. > Why isn't Float#to_r simply calling Float#rationalize ? a = 0.5337486539516013 b = 0.5337486539516012 a == b #=> false a.to_r == a #=> true a.rationalize == a #=> false a.to_r == b #=> false a.rationalize == b #=> true actually, flonum is restricted rational number. however, rationalize bends the value. to_r is the simplest and the cheapest way, rationalize is not so. moreover, various languages support exact conversion (e.g. CL, Scheme, Haskell, Squeak, Python). ---------------------------------------- http://redmine.ruby-lang.org/issues/show/1408 ---------------------------------------- http://redmine.ruby-lang.org