summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-29 22:50:11 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-05-29 22:50:11 +0000
commitf0de89f81ae37ed8b12427c375bc5ad06bcfba0e (patch)
tree86bb303355c3078ca116debb66e88d411625af28 /numeric.c
parentf13e0ec80e9c98e42db2e0d48978c60c64c7cf6d (diff)
merges r31286 from trunk into ruby_1_9_2.
-- * 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/branches/ruby_1_9_2@31803 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index ce5031428d..c67043e25e 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1592,7 +1592,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));
}