3 ms·
> Ruby's int.to_f seems much nicer than a built-in function float(int) I multiply by 1.0 to turn an int into a float: Python 2.5.1 (r251:54863, Jul 31 2008
by cabalamat 18y ago
> Ruby's int.to_f seems much nicer than a built-in function float(int)
I multiply by 1.0 to turn an int into a float:
Python 2.5.1 (r251:54863, Jul 31 2008, 23:17:40)
>>> 3/2
1
>>> 3*1.0/2
1.5
>>> float(3)/2
1.5