For example, take this IRB session:
1.9.3-p385 :046 > float = func_that_creates_large_float
=> 1.5815450433041317e+51
1.9.3-p385 :047 > float.to_i
=> 1581545043304131697954259018410479150921451567054848
Can I be sure that the integer returned to me represents the same value as the float? I ask mainly because the Ruby documentation describes the to_i
method on the Float class as "Returns the float truncated to an Integer". The word 'truncated' jumps out at me.
Edit: I think describing my situation would make it clear why I'm asking this. I'm trying to take the cube root of a large integer that I know will result in an integer as well. The cube root function uses a float to do its calculation, giving my result as a float. I need the NON-scientific-notation value and have no idea how to approach this.
Thank you.