Skip to content

Commit

Permalink
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions truffle/src/main/ruby/core/rubinius/api/shims/range_mirror.rb
Original file line number Diff line number Diff line change
@@ -16,6 +16,21 @@ def excl
@object.exclude_end?
end

# Local fix until Rubinius is fixed upstream.
def step_float_iterations_size(first, last, step_size)
err = (first.abs + last.abs + (last - first).abs) / step_size.abs * Float::EPSILON
err = 0.5 if err > 0.5

if excl
iterations = ((last - first) / step_size - err).floor
iterations += 1 if iterations * step_size + first < last
else
iterations = ((last - first) / step_size + err).floor + 1
end

iterations
end

end
end
end

0 comments on commit 186fc0c

Please sign in to comment.