From: Masahiro TANAKA Date: 2011-09-17T19:07:27+09:00 Subject: [ruby-core:39608] Re: [Ruby 1.9 - Bug #4576] Range#step miss the last value, if end-exclusive and has float number I have not been watching ruby-core, but let me give a comment for this issue. I proposed Numeric#step algorithm for Float in [ruby-dev:20177], but that was only for the include_end-case. > �p (1...6.3).step.to_a # => [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] > �p (1.1...6).step.to_a # => [1.1, 2.1, 3.1, 4.1, 5.1] > �p (1...6).step(1.1).to_a # => [1.0, 2.1, 3.2, 4.3, 5.4] > > �p (1.0...6.6).step(1.9).to_a # => [1.0, 2.9, 4.0] > �p (1.0...6.7).step(1.9).to_a # => [1.0, 2.9, 4.8] > �p (1.0...6.8).step(1.9).to_a # => [1.0, 2.9, 4.8, 6.7] If this behaviour is expected, a possible algorithm is: --- numeric.c (revision 33288) +++ numeric.c (working copy) @@ -1690,8 +1690,16 @@ } else { if (err>0.5) err=0.5; - n = floor(n + err); - if (!excl || ((long)n)*unit+beg < end) n++; + if (excl) { + if (n>0) { + if (n