Project

General

Profile

Bug #3785

unexpected Numeric#step behaviour

Added by etehtsea (Konstantin Shabanov) over 9 years ago. Updated about 9 years ago.

Status:
Rejected
Priority:
Normal
Assignee:
-
Target version:
ruby -v:
ruby-1.9.2-head
Backport:
[ruby-core:32042]

Description

=begin
ruby-1.9.2-head > -0.5.step(0.5, 0.1) { |x| puts x }
-0.5
-0.4
-0.3
-0.19999999999999996
-0.09999999999999998
0.0
0.10000000000000009
0.20000000000000007
0.30000000000000004
0.4
0.5
=> -0.5


The same with 1.9.2-p0, but with 1.9.1-p429 and 1.8.7-p302:


ruby-1.8.7-p302 > -0.5.step(0.5, 0.1) { |x| puts x }
-0.5
-0.4
-0.3
-0.2
-0.1
0.0
0.1
0.2
0.3
0.4
0.5
=> -0.5


=end


Related issues

Is duplicate of Ruby master - Bug #3746: Incorrect Float subtractionRejected08/26/2010Actions
#1

Updated by darix (Marcus Rückert) over 9 years ago

=begin
maybe the links posted in this ticket http://redmine.ruby-lang.org/issues/show/3746 help?
=end

#2

Updated by naruse (Yui NARUSE) over 9 years ago

  • Status changed from Open to Rejected

=begin
Learn floating point numbers.
=end

Also available in: Atom PDF