ruby-changes:44489
From: nagachika <ko1@a...>
Date: Sat, 5 Nov 2016 11:32:17 +0900 (JST)
Subject: [ruby-changes:44489] nagachika:r56562 (ruby_2_3): merge revision(s) 56550:
nagachika 2016-11-05 11:32:13 +0900 (Sat, 05 Nov 2016) New Revision: 56562 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56562 Log: merge revision(s) 56550: * ext/bigdecimal/bigdecimal.c: Import changes from ruby/bigdecimal repository. Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/ext/bigdecimal/bigdecimal.c branches/ruby_2_3/version.h Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 56561) +++ ruby_2_3/version.h (revision 56562) @@ -1,10 +1,10 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.2" -#define RUBY_RELEASE_DATE "2016-10-18" -#define RUBY_PATCHLEVEL 200 +#define RUBY_RELEASE_DATE "2016-11-05" +#define RUBY_PATCHLEVEL 201 #define RUBY_RELEASE_YEAR 2016 -#define RUBY_RELEASE_MONTH 10 -#define RUBY_RELEASE_DAY 18 +#define RUBY_RELEASE_MONTH 11 +#define RUBY_RELEASE_DAY 5 #include "ruby/version.h" Index: ruby_2_3/ext/bigdecimal/bigdecimal.c =================================================================== --- ruby_2_3/ext/bigdecimal/bigdecimal.c (revision 56561) +++ ruby_2_3/ext/bigdecimal/bigdecimal.c (revision 56562) @@ -2533,7 +2533,7 @@ BigDecimal_initialize(int argc, VALUE *a https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L2533 /* :nodoc: * - * private method to dup and clone the provided BigDecimal +other+ + * private method for dup and clone the provided BigDecimal +other+ */ static VALUE BigDecimal_initialize_copy(VALUE self, VALUE other) @@ -2769,7 +2769,7 @@ BigMath_s_exp(VALUE klass, VALUE x, VALU https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L2769 rb_raise(rb_eArgError, "Zero or negative precision for exp"); } - /* TODO: the following switch statement is almostly the same as one in the + /* TODO: the following switch statement is almost same as one in the * BigDecimalCmp function. */ switch (TYPE(x)) { case T_DATA: @@ -2907,7 +2907,7 @@ BigMath_s_log(VALUE klass, VALUE x, VALU https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L2907 rb_raise(rb_eArgError, "Zero or negative precision for exp"); } - /* TODO: the following switch statement is almostly the same as one in the + /* TODO: the following switch statement is almost same as one in the * BigDecimalCmp function. */ switch (TYPE(x)) { case T_DATA: @@ -3135,9 +3135,8 @@ get_vp_value: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L3135 * * Copyright (C) 2002 by Shigeo Kobayashi <shigeo@t...>. * - * You may distribute under the terms of either the GNU General Public - * License or the Artistic License, as specified in the README file - * of the BigDecimal distribution. + * BigDecimal is released under the Ruby and 2-clause BSD licenses. + * See LICENSE.txt for details. * * Maintained by mrkn <mrkn@m...> and ruby-core members. * @@ -3915,28 +3914,28 @@ VpAlloc(size_t mx, const char *szVal) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L3914 if (mx == 0) ++mx; if (szVal) { - while (ISSPACE(*szVal)) szVal++; - if (*szVal != '#') { - if (mf) { - mf = (mf + BASE_FIG - 1) / BASE_FIG + 2; /* Needs 1 more for div */ - if (mx > mf) { - mx = mf; - } - } - } - else { - ++szVal; - } + while (ISSPACE(*szVal)) szVal++; + if (*szVal != '#') { + if (mf) { + mf = (mf + BASE_FIG - 1) / BASE_FIG + 2; /* Needs 1 more for div */ + if (mx > mf) { + mx = mf; + } + } + } + else { + ++szVal; + } } else { - /* necessary to be able to store */ - /* at least mx digits. */ - /* szVal==NULL ==> allocate zero value. */ - vp = VpAllocReal(mx); - /* xmalloc() alway returns(or throw interruption) */ - vp->MaxPrec = mx; /* set max precision */ - VpSetZero(vp, 1); /* initialize vp to zero. */ - return vp; + /* necessary to be able to store */ + /* at least mx digits. */ + /* szVal==NULL ==> allocate zero value. */ + vp = VpAllocReal(mx); + /* xmalloc() alway returns(or throw interruption) */ + vp->MaxPrec = mx; /* set max precision */ + VpSetZero(vp, 1); /* initialize vp to zero. */ + return vp; } /* Skip all '_' after digit: 2006-6-30 */ @@ -3946,43 +3945,42 @@ VpAlloc(size_t mx, const char *szVal) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L3945 i = 0; ipn = 0; while ((psz[i] = szVal[ipn]) != 0) { - if (ISDIGIT(psz[i])) ++ni; - if (psz[i] == '_') { - if (ni > 0) { - ipn++; - continue; - } - psz[i] = 0; - break; - } - ++i; - ++ipn; - } - /* Skip trailing spaces */ - while (--i > 0) { - if (ISSPACE(psz[i])) psz[i] = 0; - else break; + if (ISSPACE(psz[i])) { + psz[i] = 0; + break; + } + if (ISDIGIT(psz[i])) ++ni; + if (psz[i] == '_') { + if (ni > 0) { + ipn++; + continue; + } + psz[i] = 0; + break; + } + ++i; + ++ipn; } szVal = psz; /* Check on Inf & NaN */ if (StrCmp(szVal, SZ_PINF) == 0 || StrCmp(szVal, SZ_INF) == 0 ) { - vp = VpAllocReal(1); - vp->MaxPrec = 1; /* set max precision */ - VpSetPosInf(vp); - return vp; + vp = VpAllocReal(1); + vp->MaxPrec = 1; /* set max precision */ + VpSetPosInf(vp); + return vp; } if (StrCmp(szVal, SZ_NINF) == 0) { - vp = VpAllocReal(1); - vp->MaxPrec = 1; /* set max precision */ - VpSetNegInf(vp); - return vp; + vp = VpAllocReal(1); + vp->MaxPrec = 1; /* set max precision */ + VpSetNegInf(vp); + return vp; } if (StrCmp(szVal, SZ_NaN) == 0) { - vp = VpAllocReal(1); - vp->MaxPrec = 1; /* set max precision */ - VpSetNaN(vp); - return vp; + vp = VpAllocReal(1); + vp->MaxPrec = 1; /* set max precision */ + VpSetNaN(vp); + return vp; } /* check on number szVal[] */ @@ -3992,45 +3990,45 @@ VpAlloc(size_t mx, const char *szVal) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L3990 /* Skip digits */ ni = 0; /* digits in mantissa */ while ((v = szVal[i]) != 0) { - if (!ISDIGIT(v)) break; - ++i; - ++ni; + if (!ISDIGIT(v)) break; + ++i; + ++ni; } nf = 0; ipf = 0; ipe = 0; ne = 0; if (v) { - /* other than digit nor \0 */ - if (szVal[i] == '.') { /* xxx. */ - ++i; - ipf = i; - while ((v = szVal[i]) != 0) { /* get fraction part. */ - if (!ISDIGIT(v)) break; - ++i; - ++nf; - } - } - ipe = 0; /* Exponent */ - - switch (szVal[i]) { - case '\0': - break; - case 'e': case 'E': - case 'd': case 'D': - ++i; - ipe = i; - v = szVal[i]; - if ((v == '-') || (v == '+')) ++i; - while ((v=szVal[i]) != 0) { - if (!ISDIGIT(v)) break; - ++i; - ++ne; - } - break; - default: - break; - } + /* other than digit nor \0 */ + if (szVal[i] == '.') { /* xxx. */ + ++i; + ipf = i; + while ((v = szVal[i]) != 0) { /* get fraction part. */ + if (!ISDIGIT(v)) break; + ++i; + ++nf; + } + } + ipe = 0; /* Exponent */ + + switch (szVal[i]) { + case '\0': + break; + case 'e': case 'E': + case 'd': case 'D': + ++i; + ipe = i; + v = szVal[i]; + if ((v == '-') || (v == '+')) ++i; + while ((v=szVal[i]) != 0) { + if (!ISDIGIT(v)) break; + ++i; + ++ne; + } + break; + default: + break; + } } nalloc = (ni + nf + BASE_FIG - 1) / BASE_FIG + 1; /* set effective allocation */ /* units for szVal[] */ @@ -4099,7 +4097,7 @@ VpAsgn(Real *c, Real *a, int isw) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L4097 /* * c = a + b when operation = 1 or 2 - * = a - b when operation = -1 or -2. + * c = a - b when operation = -1 or -2. * Returns number of significant digits of c */ VP_EXPORT size_t @@ -4232,7 +4230,7 @@ end_if: https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L4230 } /* - * Addition of two variable precisional variables + * Addition of two values with variable precision * a and b assuming abs(a)>abs(b). * c = abs(a) + abs(b) ; where |a|>=|b| */ @@ -4991,7 +4989,7 @@ VpComp(Real *a, Real *b) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ext/bigdecimal/bigdecimal.c#L4989 goto Exit; } - /* a and b have same exponent, then compare significand. */ + /* a and b have same exponent, then compare their significand. */ mx = (a->Prec < b->Prec) ? a->Prec : b->Prec; ind = 0; while (ind < mx) { Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 56561) +++ ruby_2_3/ChangeLog (revision 56562) @@ -1,3 +1,8 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Sat Nov 5 11:16:58 2016 Kenta Murata <mrkn@m...> + + * ext/bigdecimal/bigdecimal.c: Import changes from ruby/bigdecimal + repository. + Tue Oct 18 02:58:22 2016 Kazuki Yamaguchi <k@r...> * eval_intern.h (TH_PUSH_TAG): Initialize struct rb_vm_tag::tag with Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo Merged /trunk:r56550 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/