flt.rationalize([eps]) â rational
Instance Public methods
Returns a simpler approximation of the value (flt-|eps| <= result <= flt+|eps|). if the optional eps is not given, it will be chosen automatically.
1 2 3 | 0 . 3 .rationalize #=> (3/10) 1 . 333 .rationalize #=> (1333/1000) 1 . 333 .rationalize( 0 . 01 ) #=> (4/3) |
See to_r.
Please login to continue.