Welcome to the world of Float ;)
(look the mailing list about Float, we will not repeat the same 100 times ;)
)

~ $> ruby -ve 'p 19.99 * 100'
ruby 1.9.2dev (2010-01-14 trunk 26319) [x86_64-darwin10.2.0]
1998.9999999999998

In 1.9, you would be able to see the Float with all the decimals, with no
rounding like before.
(For once I admit this new view is quite useful, but I would do this
behavior only for #inspect, not #to_s)

Never expect Float to be exact, consider them as approximation.


2010/1/15 Edmond Chui <redmine / ruby-lang.org>

> Bug #2608: 1999.0 becomes 1998
> http://redmine.ruby-lang.org/issues/show/2608
>
> Author: Edmond Chui
> Status: Open, Priority: High
> ruby -v: 1.8.7
>
> The following script generate wrong result
>
> a = 19.99 * 100
> puts a.to_i  # Prints out 1998. Should be 1999.
>
>
> ----------------------------------------
> http://redmine.ruby-lang.org
>
>