diff --git a/ChangeLog b/ChangeLog index 330298b155..b3849b7616 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Aug 23 02:23:05 2010 NARUSE, Yui + + * util.c (ruby_strtod): make sure to have digit-sequence after 'p' + for hexadecimal-floating-constant. [ruby-dev:42105] + Sun Aug 22 09:08:02 2010 Tanaka Akira * include/ruby/ruby.h (UINT2NUM): fix ifdef condition for LLP64. diff --git a/test/ruby/test_float.rb b/test/ruby/test_float.rb index 03d9c94766..2f3bb7952e 100644 --- a/test/ruby/test_float.rb +++ b/test/ruby/test_float.rb @@ -429,6 +429,8 @@ class TestFloat < Test::Unit::TestCase assert_equal(1, Float(([1] * 10000).join).infinite?) assert(!Float(([1] * 10000).join("_")).infinite?) # is it really OK? assert_raise(ArgumentError) { Float("1.0\x001") } + assert_equal(15.9375, Float('0xf.fp0')) + assert_raise(ArgumentError) { Float('0xf.fp') } assert_equal(1, Float("1e10_00").infinite?) assert_raise(TypeError) { Float(nil) } o = Object.new diff --git a/util.c b/util.c index d42e1662fa..1c0d8d6c7b 100644 --- a/util.c +++ b/util.c @@ -2139,11 +2139,15 @@ break2: if (abs(dsign) == 1) s++; else dsign = 1; - for (nd = 0; (c = *s) >= '0' && c <= '9'; s++) { + nd = 0; + c = *s; + if (c < '0' || '9' < c) goto ret0; + do { nd *= 10; nd += c; nd -= '0'; - } + c = *++s; + } while ('0' <= c && c <= '9'); dval(rv) = ldexp(adj, nd * dsign); } else { diff --git a/version.h b/version.h index 587e3fbe70..35120a1090 100644 --- a/version.h +++ b/version.h @@ -1,6 +1,6 @@ #define RUBY_VERSION "1.9.2" #define RUBY_RELEASE_DATE "2010-09-29" -#define RUBY_PATCHLEVEL 6 +#define RUBY_PATCHLEVEL 7 #define RUBY_VERSION_MAJOR 1 #define RUBY_VERSION_MINOR 9