diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-14 14:50:46 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-04-14 14:50:46 +0000 |
commit | 9d5f651a9815bce2ff48010f50b591af722b7712 (patch) | |
tree | 0cd57da6189ebae5c9342660defe5e4271bd5809 /numeric.c | |
parent | 716a99389c36e7e15c932f8ce4a0229b9756b185 (diff) |
* numeric.c (ruby_float_step): wrong loop condition.
fixes [ruby-core:35753], reported by Joey Zhou.
* test/ruby/test_range.rb (TestRange#test_step_ruby_core_35753):
test above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31286 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -1634,7 +1634,7 @@ ruby_float_step(VALUE from, VALUE to, VALUE step, int excl) else { if (err>0.5) err=0.5; n = floor(n + err); - if (!excl) n++; + if (!excl || ((long)n)*unit+beg < end) n++; for (i=0; i<n; i++) { rb_yield(DBL2NUM(i*unit+beg)); } |