From f0de89f81ae37ed8b12427c375bc5ad06bcfba0e Mon Sep 17 00:00:00 2001 From: yugui Date: Sun, 29 May 2011 22:50:11 +0000 Subject: [PATCH] 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 --- ChangeLog | 8 ++++++++ numeric.c | 2 +- test/ruby/test_range.rb | 9 +++++++++ version.h | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6063f9a223..a2d2b69412 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 21:21:06 2011 Nobuyoshi Nakada * include/ruby/win32.h (frexp, modf): wrongly declared as pure in 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