Friday, April 5, 2013

Ruby thinks (19.99 * 100).to_i = 1998


March 26th, 2009 By: Daniel

>> (19.99 * 100).to_i
=> 1998
>> (9.99 * 100).to_i
=> 999
Someone please tell me what’s up with that!
In the meantime:
>> (19.99 * 100).to_s.to_i
=> 1999

2 comments: