Bug #4135
closedbug in calculations in 1.9.3dev / 1.9.2
Description
=begin
$ ruby -v
ruby 1.9.3dev (2010-12-08 trunk 30125) [i686-linux]
I just installed ruby-head from rvm and run this in irb:
$ irb
ruby-head > 125.33 - (125.33/100.0*50.0)
=> 62.66499999999999
ruby-head > 125.33 / 100.0 * 50.0
=> 62.665000000000006
ruby-head > 15.33 / 100.0 * 50.0
=> 7.664999999999999
ruby-head > (15.33 / 100.0) * 50.0
=> 7.664999999999999
ruby-head > (14.33 / 100.0) * 50.0
=> 7.165000000000001
Which is obviously wrong.
The same in old ruby 1.9.2.dev
$ ruby -v
ruby 1.9.2dev (2009-07-18 trunk 24186) [i686-linux]
$ irb
ruby-1.9.2-preview1 > (14.33 / 100.0) * 50.0
=> 7.165000000000001
Ruby 1.8.7 looks good
$ ruby -v
ruby 1.8.7 (2010-04-19 patchlevel 253) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2010.02
$ irb
irb(main):001:0> (14.33 / 100.0) * 50.0
=> 7.165
=end