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