2013/4/6 David MacMahon <davidm / astro.berkeley.edu>:

> I understand that the Float returned by Rational#to_f has limited precisi=
on and often will only approximate but not equal the value represented by t=
he Rational.  But in the example of 57563.232824357045 we are talking about=
 a Float value that is representable.  I think it is reasonable to expect f=
.to_r.to_f =3D=3D f.  I think that this is possible, but it requires changi=
ng both Float#to_r and Rational#to_f and I do not have a sense of whether i=
t is practical from a performance point of view.
>

57563.232824357045 is not representable as a Float.
f.to_r.to_f =3D=3D f is true.

% ruby -e 'f =3D 57563.232824357045; p "%.1000g" % f, f.to_r.to_f =3D=3D f'
"57563.2328243570445920340716838836669921875"
true

The actual value of the Float value is
57563.2328243570445920340716838836669921875.
--=20
Tanaka Akira