ruby-changes:47109
From: usa <ko1@a...>
Date: Fri, 30 Jun 2017 20:08:41 +0900 (JST)
Subject: [ruby-changes:47109] usa:r59224 (ruby_2_3): merge revision(s) 58796: [Backport #13545]
usa 2017-06-30 20:08:35 +0900 (Fri, 30 Jun 2017) New Revision: 59224 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=59224 Log: merge revision(s) 58796: [Backport #13545] Merge latest dtoa.c [Bug #13545] Apply some part of http://www.netlib.org/fp/dtoa.c with my eyes... Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/test/ruby/test_float.rb branches/ruby_2_3/util.c branches/ruby_2_3/version.h Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 59223) +++ ruby_2_3/ChangeLog (revision 59224) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Fri Jun 30 20:07:37 2017 NARUSE, Yui <naruse@r...> + + * util.c (ruby_strtod) Merge latest dtoa.c [Bug #13545] + Apply some part of http://www.netlib.org/fp/dtoa.c with my eyes... + Fri Jun 30 20:00:18 2017 Nobuyoshi Nakada <nobu@r...> * dir.c (is_case_sensitive): use getattrlist() if fgetattrlist() is Index: ruby_2_3/util.c =================================================================== --- ruby_2_3/util.c (revision 59223) +++ ruby_2_3/util.c (revision 59224) @@ -2100,7 +2100,7 @@ break2: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/util.c#L2100 for (nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++) if (nd < 9) y = 10*y + c - '0'; - else if (nd < 16) + else if (nd < DBL_DIG + 2) z = 10*z + c - '0'; nd0 = nd; #ifdef USE_LOCALE @@ -2140,17 +2140,19 @@ break2: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/util.c#L2140 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++) if (nd++ < 9) y *= 10; - else if (nd <= DBL_DIG + 1) + else if (nd <= DBL_DIG + 2) z *= 10; if (nd++ < 9) y = 10*y + c; - else if (nd <= DBL_DIG + 1) + else if (nd <= DBL_DIG + 2) z = 10*z + c; nz = 0; } @@ -2238,7 +2240,7 @@ ret0: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/util.c#L2240 if (!nd0) nd0 = nd; - k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1; + k = nd < DBL_DIG + 2 ? nd : DBL_DIG + 2; dval(rv) = y; if (k > 9) { #ifdef SET_INEXACT Index: ruby_2_3/test/ruby/test_float.rb =================================================================== --- ruby_2_3/test/ruby/test_float.rb (revision 59223) +++ ruby_2_3/test/ruby/test_float.rb (revision 59224) @@ -16,6 +16,8 @@ class TestFloat < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_3/test/ruby/test_float.rb#L16 assert_in_delta(13.4 % 1, 0.4, 0.0001) assert_equal(36893488147419111424, 36893488147419107329.0.to_i) + assert_equal(1185151044158398820374743613440, + 1.1851510441583988e+30.to_i) end def nan_test(x,y) Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 59223) +++ ruby_2_3/version.h (revision 59224) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.5" #define RUBY_RELEASE_DATE "2017-06-30" -#define RUBY_PATCHLEVEL 320 +#define RUBY_PATCHLEVEL 321 #define RUBY_RELEASE_YEAR 2017 #define RUBY_RELEASE_MONTH 6 Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 59223) +++ ruby_2_3 (revision 59224) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r58796 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/