Issue #9575 has been updated by Marc-Andre Lafortune.

Status changed from Feedback to Open

Yui NARUSE wrote:
> r45209 conflicts with current ruby_2_1 branch.

Right, #9570 must be backported first.

More explicitly, the following will backport both without conflicts:

    git cherry-pick c1fc20124c
    git cherry-pick e184e31c0956..1636c60fe16

> yeah, could you add NEWS and additional previous commits and NEWS commit?

I pushed r45234 (ec8de033e72935)

I hope that's what you wanted?


----------------------------------------
Backport #9575: Step with 0 step is buggy
https://bugs.ruby-lang.org/issues/9575#change-45563

* Author: Marc-Andre Lafortune
* Status: Open
* Priority: Normal
* Assignee: Yui NARUSE
----------------------------------------
I didn't realize that we now allow stepping with a '0' step. It should probably have been mentioned in the NEWS of 2.1.0?

Anyways, couple of bugs with that new feature:

    bn = 1 << 100
    bn.step(by: 0, to: bn).first(2) # => [bn, bn] ok
    bn.step(by: 0).first(2)         # => [bn.to_f, bn.to_f] not ok
    bn.step(by: 0, to: 0).first(2)  # => [] not ok

The corresponding `size` don't all work either:

    bn.step(by: 0) # => Float::INFINITY, ok
    bn.step(by: 0, to: bn).size # => ZeroDivisionError: divided by 0, should be infinity
    bn.step(by: 0, to: 0).size  # => same
    1.step(by:0, to: 42).size   # => same

My patch is almost finished.



-- 
http://bugs.ruby-lang.org/