Project

General

Profile

Actions

Bug #3785

closed

unexpected Numeric#step behaviour

Added by etehtsea (Konstantin Shabanov) over 14 years ago. Updated over 13 years ago.

Status:
Rejected
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 1 (0 open1 closed)

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

Also available in: Atom PDF

Like0
Like0Like0