ruby-changes:31699
From: nagachika <ko1@a...>
Date: Fri, 22 Nov 2013 13:00:52 +0900 (JST)
Subject: [ruby-changes:31699] nagachika:r43778 (ruby_2_0_0): merge revision(s) 43775:
nagachika 2013-11-22 13:00:39 +0900 (Fri, 22 Nov 2013) New Revision: 43778 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=43778 Log: merge revision(s) 43775: * util.c (ruby_strtod): ignore too long fraction part, which does not affect the result. Modified directories: branches/ruby_2_0_0/ Modified files: branches/ruby_2_0_0/ChangeLog branches/ruby_2_0_0/test/ruby/test_float.rb branches/ruby_2_0_0/util.c branches/ruby_2_0_0/version.h Index: ruby_2_0_0/ChangeLog =================================================================== --- ruby_2_0_0/ChangeLog (revision 43777) +++ ruby_2_0_0/ChangeLog (revision 43778) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/ChangeLog#L1 +Fri Nov 22 12:46:08 2013 Nobuyoshi Nakada <nobu@r...> + + * util.c (ruby_strtod): ignore too long fraction part, which does not + affect the result. + Wed Nov 20 15:20:00 2013 CHIKANAGA Tomoyuki <nagachika@r...> * test/ruby/test_thread.rb (test_mutex_unlock_on_trap): extend waiting Index: ruby_2_0_0/util.c =================================================================== --- ruby_2_0_0/util.c (revision 43777) +++ ruby_2_0_0/util.c (revision 43778) @@ -715,6 +715,11 @@ extern void *MALLOC(size_t); https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/util.c#L715 #else #define MALLOC malloc #endif +#ifdef FREE +extern void FREE(void*); +#else +#define FREE free +#endif #ifndef Omit_Private_Memory #ifndef PRIVATE_MEM @@ -1005,7 +1010,7 @@ Balloc(int k) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/util.c#L1010 #endif ACQUIRE_DTOA_LOCK(0); - if ((rv = freelist[k]) != 0) { + if (k <= Kmax && (rv = freelist[k]) != 0) { freelist[k] = rv->next; } else { @@ -1015,7 +1020,7 @@ Balloc(int k) https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/util.c#L1020 #else len = (sizeof(Bigint) + (x-1)*sizeof(ULong) + sizeof(double) - 1) /sizeof(double); - if (pmem_next - private_mem + len <= PRIVATE_mem) { + if (k <= Kmax && pmem_next - private_mem + len <= PRIVATE_mem) { rv = (Bigint*)pmem_next; pmem_next += len; } @@ -1034,6 +1039,10 @@ static void https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/util.c#L1039 Bfree(Bigint *v) { if (v) { + if (v->k > Kmax) { + FREE(v); + return; + } ACQUIRE_DTOA_LOCK(0); v->next = freelist[v->k]; freelist[v->k] = v; @@ -2097,6 +2106,7 @@ break2: https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/util.c#L2106 for (; c >= '0' && c <= '9'; c = *++s) { have_dig: nz++; + if (nf > DBL_DIG * 2) continue; if (c -= '0') { nf += nz; for (i = 1; i < nz; i++) Index: ruby_2_0_0/version.h =================================================================== --- ruby_2_0_0/version.h (revision 43777) +++ ruby_2_0_0/version.h (revision 43778) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/version.h#L1 #define RUBY_VERSION "2.0.0" -#define RUBY_RELEASE_DATE "2013-11-21" -#define RUBY_PATCHLEVEL 351 +#define RUBY_RELEASE_DATE "2013-11-22" +#define RUBY_PATCHLEVEL 352 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 11 -#define RUBY_RELEASE_DAY 21 +#define RUBY_RELEASE_DAY 22 #include "ruby/version.h" Index: ruby_2_0_0/test/ruby/test_float.rb =================================================================== --- ruby_2_0_0/test/ruby/test_float.rb (revision 43777) +++ ruby_2_0_0/test/ruby/test_float.rb (revision 43778) @@ -613,4 +613,10 @@ class TestFloat < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/ruby_2_0_0/test/ruby/test_float.rb#L613 # always not flonum assert_raise(TypeError) { a = Float::INFINITY; def a.foo; end } end + + def test_long_string + assert_separately([], <<-'end;') + assert_in_epsilon(10.0, ("1."+"1"*300000).to_f*9) + end; + end end Property changes on: ruby_2_0_0 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r43775 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/