* util.c (ruby_strtod): make sure to have digit-sequence after 'p'
for hexadecimal-floating-constant. [ruby-dev:42105] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29073 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
54f3440959
commit
815ab02971
@ -1,3 +1,8 @@
|
|||||||
|
Mon Aug 23 02:23:05 2010 NARUSE, Yui <naruse@ruby-lang.org>
|
||||||
|
|
||||||
|
* util.c (ruby_strtod): make sure to have digit-sequence after 'p'
|
||||||
|
for hexadecimal-floating-constant. [ruby-dev:42105]
|
||||||
|
|
||||||
Mon Aug 23 00:23:07 2010 Tadayoshi Funaba <tadf@dotrb.org>
|
Mon Aug 23 00:23:07 2010 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* lib/date.rb, lib/date/format.rb: [ruby-core:31695]
|
* lib/date.rb, lib/date/format.rb: [ruby-core:31695]
|
||||||
|
@ -446,6 +446,8 @@ class TestFloat < Test::Unit::TestCase
|
|||||||
assert_equal(1, suppress_warning {Float(([1] * 10000).join)}.infinite?)
|
assert_equal(1, suppress_warning {Float(([1] * 10000).join)}.infinite?)
|
||||||
assert(!Float(([1] * 10000).join("_")).infinite?) # is it really OK?
|
assert(!Float(([1] * 10000).join("_")).infinite?) # is it really OK?
|
||||||
assert_raise(ArgumentError) { Float("1.0\x001") }
|
assert_raise(ArgumentError) { Float("1.0\x001") }
|
||||||
|
assert_equal(15.9375, Float('0xf.fp0'))
|
||||||
|
assert_raise(ArgumentError) { Float('0xf.fp') }
|
||||||
assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?)
|
assert_equal(1, suppress_warning {Float("1e10_00")}.infinite?)
|
||||||
assert_raise(TypeError) { Float(nil) }
|
assert_raise(TypeError) { Float(nil) }
|
||||||
o = Object.new
|
o = Object.new
|
||||||
|
8
util.c
8
util.c
@ -2141,11 +2141,15 @@ break2:
|
|||||||
if (abs(dsign) == 1) s++;
|
if (abs(dsign) == 1) s++;
|
||||||
else dsign = 1;
|
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 *= 10;
|
||||||
nd += c;
|
nd += c;
|
||||||
nd -= '0';
|
nd -= '0';
|
||||||
}
|
c = *++s;
|
||||||
|
} while ('0' <= c && c <= '9');
|
||||||
dval(rv) = ldexp(adj, nd * dsign);
|
dval(rv) = ldexp(adj, nd * dsign);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user