rat.to_f â float
Instance Public methods
Return the value as a float.
1 2 3 4 | Rational( 2 ).to_f #=> 2.0 Rational( 9 , 4 ).to_f #=> 2.25 Rational(- 3 , 4 ).to_f #=> -0.75 Rational( 20 , 3 ).to_f #=> 6.666666666666667 |
Return the value as a float.
1 2 3 4 | Rational( 2 ).to_f #=> 2.0 Rational( 9 , 4 ).to_f #=> 2.25 Rational(- 3 , 4 ).to_f #=> -0.75 Rational( 20 , 3 ).to_f #=> 6.666666666666667 |
Designed by : w10schools
service@w10schools.com
Please login to continue.