0.6.to_r is considered as a rational converted from a floating point number 0.5999999999999999777955395074968691915273666381835937500.
"0.6".to_r is considered as Rational(6, 10).
So they are slightly different number.
Use Float#rationalize instead of to_r, and you will get the same result as String#to_r. I've argued before that Float#to_r should be Float#rationalize, though.
Use Float#rationalize instead of to_r, and you will get the same result as String#to_r.
I've argued before that Float#to_r should be Float#rationalize, though.