Project

General

Profile

Actions

Bug #4135

closed

bug in calculations in 1.9.3dev / 1.9.2

Added by german (Dmitrii Samoilov) almost 14 years ago. Updated over 13 years ago.

Status:
Rejected
Assignee:
-
Target version:
ruby -v:
ruby 1.9.3dev (2010-12-08 trunk 30125) [i686-linux]
Backport:
[ruby-core:33637]

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


Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #3746: Incorrect Float subtractionRejected08/26/2010Actions
Actions #1

Updated by nobu (Nobuyoshi Nakada) almost 14 years ago

  • Status changed from Open to Rejected

=begin

=end

Actions #3

Updated by german (Dmitrii Samoilov) almost 14 years ago

=begin
Stupid me. Sorry guys.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0Like0