cmp.to_r â rational
Instance Public methods
Returns the value as a rational if possible (the imaginary part should be exactly zero).
1 2 3 | Complex( 1 , 0 ).to_r #=> (1/1) Complex( 1 , 0 . 0 ).to_r # RangeError Complex( 1 , 2 ).to_r # RangeError |
See rationalize.
Please login to continue.