method
rationalize
v1_9_2_180 -
Show latest stable
-
0 notes -
Class: Float
- 1_8_6_287
- 1_8_7_72
- 1_8_7_330
- 1_9_1_378
- 1_9_2_180 (0)
- 1_9_3_125 (0)
- 1_9_3_392 (0)
- 2_1_10 (17)
- 2_2_9 (0)
- 2_4_6 (0)
- 2_5_5 (38)
- 2_6_3 (0)
- What's this?
rationalize(p1 = v1)
public
Returns a simpler approximation of the value (flt-|eps| <= result <= flt+|eps|). if eps is not given, it will be chosen automatically.
For example:
0.3.rationalize #=> (3/10) 1.333.rationalize #=> (1333/1000) 1.333.rationalize(0.01) #=> (4/3)