aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--test/ruby/test_literal.rb1
-rw-r--r--util.c2
3 files changed, 8 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 1313d5c71a..fdade505fc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+Fri Jul 15 17:08:57 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
+
+ * util.c (ruby_strtod): do not underflow only by preceeding zeros,
+ which may be canceled out by the exponent.
+ http://twitter.com/kazuho/status/753829998767714305
+
Fri Jul 15 15:32:13 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* time.c (time_arg): it seems that this function sometimes causes SEGV
diff --git a/test/ruby/test_literal.rb b/test/ruby/test_literal.rb
index c37b206539..05b81f944d 100644
--- a/test/ruby/test_literal.rb
+++ b/test/ruby/test_literal.rb
@@ -493,6 +493,7 @@ class TestRubyLiteral < Test::Unit::TestCase
}
}
}
+ assert_equal(100.0, 0.0000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100e100)
end
def test_symbol_list
diff --git a/util.c b/util.c
index 0b0c935832..17819e522a 100644
--- a/util.c
+++ b/util.c
@@ -2145,7 +2145,7 @@ break2:
for (; c >= '0' && c <= '9'; c = *++s) {
have_dig:
nz++;
- if (nf > DBL_DIG * 4) continue;
+ if (nd > DBL_DIG * 4) continue;
if (c -= '0') {
nf += nz;
for (i = 1; i < nz; i++)