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