Project

General

Profile

Actions

Bug #3785

closed

unexpected Numeric#step behaviour

Added by etehtsea (Konstantin Shabanov) about 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 #1

Updated by darix (Marcus Rückert) about 14 years ago

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

Actions #2

Updated by naruse (Yui NARUSE) about 14 years ago

  • Status changed from Open to Rejected

=begin
Learn floating point numbers.
=end

Actions

Also available in: Atom PDF

Like0
Like0Like0