From 9d5f651a9815bce2ff48010f50b591af722b7712 Mon Sep 17 00:00:00 2001 From: usa Date: Thu, 14 Apr 2011 14:50:46 +0000 Subject: [PATCH] * 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 --- ChangeLog | 8 ++++++++ numeric.c | 2 +- test/ruby/test_range.rb | 9 +++++++++ 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 9b1387452c..da4d4250b2 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,11 @@ +Thu Apr 14 23:43:43 2011 NAKAMURA Usaku + + * 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. + Thu Apr 14 22:48:12 2011 Nobuyoshi Nakada * lib/test/unit.rb (Test::Unit::Options#setup_options): set possible diff --git a/numeric.c b/numeric.c index 34c378ba8f..35f3bd3ef4 100644 --- a/numeric.c +++ b/numeric.c @@ -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