2011/9/17 Masahiro TANAKA <masa16.tanaka / gmail.com>:
> 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:

I'm glad to see your opinion.

However the algorithm doesn't solve [ruby-core:39602] and [ruby-core:39606].

% ./ruby -e 'a = (1.0..12.7).step(1.3).to_a; p a.all? {|n| n <= 12.7 }, a.last'
false
12.700000000000001
% ./ruby -e 'e = 1+1E-12; a = (1.0 ... e).step(1E-16).to_a; p a.all?
{|n| n < e }, a.last'
false
1.000000000001

They show (s..e).step(u) yields a number greater than e and
(s...e).step(u) still yields a number greater than or equal to e.

Do you have an opinion on that?
-- 
Tanaka Akira