ruby-changes:50023
From: usa <ko1@a...>
Date: Wed, 31 Jan 2018 22:47:37 +0900 (JST)
Subject: [ruby-changes:50023] usa:r62141 (ruby_2_3): merge revision(s) 54803: [Backport #14321]
usa 2018-01-31 22:47:33 +0900 (Wed, 31 Jan 2018) New Revision: 62141 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=62141 Log: merge revision(s) 54803: [Backport #14321] * configure.in (rb_cv_lgamma_r_pm0): check if lgamma_r(+0.0) returns positive infinity, in addition to lgamma_r(-0.0). AIX returns an incorrect result of negative infinity. * math.c (ruby_lgamma_r): handle +0.0, in addition to -0.0. Modified directories: branches/ruby_2_3/ Modified files: branches/ruby_2_3/ChangeLog branches/ruby_2_3/configure.in branches/ruby_2_3/math.c branches/ruby_2_3/version.h Index: ruby_2_3/version.h =================================================================== --- ruby_2_3/version.h (revision 62140) +++ ruby_2_3/version.h (revision 62141) @@ -1,6 +1,6 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/version.h#L1 #define RUBY_VERSION "2.3.7" #define RUBY_RELEASE_DATE "2018-01-31" -#define RUBY_PATCHLEVEL 402 +#define RUBY_PATCHLEVEL 403 #define RUBY_RELEASE_YEAR 2018 #define RUBY_RELEASE_MONTH 1 Index: ruby_2_3/math.c =================================================================== --- ruby_2_3/math.c (revision 62140) +++ ruby_2_3/math.c (revision 62141) @@ -750,7 +750,7 @@ ruby_tgamma(const double d) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/math.c#L750 #define tgamma(d) ruby_tgamma(d) #endif -#if defined LGAMMA_R_M0_FIX +#if defined LGAMMA_R_PM0_FIX static inline double ruby_lgamma_r(const double d, int *sign) { @@ -759,6 +759,9 @@ ruby_lgamma_r(const double d, int *sign) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/math.c#L759 if (d == 0.0 && signbit(d)) { *sign = -1; return INFINITY; + } else if (d == 0.0 && !signbit(d)) { + *sign = 1; + return INFINITY; } } return g; Index: ruby_2_3/ChangeLog =================================================================== --- ruby_2_3/ChangeLog (revision 62140) +++ ruby_2_3/ChangeLog (revision 62141) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ruby_2_3/ChangeLog#L1 +Wed Jan 31 22:46:36 2018 Rei Odaira <Rei.Odaira@g...> + + * configure.in (rb_cv_lgamma_r_pm0): check if lgamma_r(+0.0) + returns positive infinity, in addition to lgamma_r(-0.0). + AIX returns an incorrect result of negative infinity. + + * math.c (ruby_lgamma_r): handle +0.0, in addition to -0.0. + Wed Jan 31 22:32:08 2018 Nobuyoshi Nakada <nobu@r...> ext: check if null byte is contained Index: ruby_2_3/configure.in =================================================================== --- ruby_2_3/configure.in (revision 62140) +++ ruby_2_3/configure.in (revision 62141) @@ -2493,7 +2493,7 @@ main(int argc, char **argv) https://github.com/ruby/ruby/blob/trunk/ruby_2_3/configure.in#L2493 AS_IF([test "x$rb_cv_atan2_inf_c99" = xyes], [AC_DEFINE(ATAN2_INF_C99)]) AS_IF([test "x$ac_cv_func_lgamma_r" = xyes], [ - AC_CACHE_CHECK(whether lgamma_r handles -0.0, rb_cv_lgamma_r_m0, [ + AC_CACHE_CHECK(whether lgamma_r handles +0.0 and -0.0, rb_cv_lgamma_r_pm0, [ AC_TRY_RUN([ @%:@include <math.h> @%:@ifdef HAVE_UNISTD_H @@ -2509,22 +2509,28 @@ AS_IF([test "x$ac_cv_func_lgamma_r" = xy https://github.com/ruby/ruby/blob/trunk/ruby_2_3/configure.in#L2509 int main(int argc, char **argv) { - int sign; + int sign = 0; double x = lgamma_r(-0.0, &sign); /* should be [+inf, -1] */ if (x <= 0) return EXIT_FAILURE; if (!isinf(x)) return EXIT_FAILURE; if (sign != -1) return EXIT_FAILURE; + + /* should be [+inf, 1] */ + x = lgamma_r(+0.0, &sign); + if (x <= 0) return EXIT_FAILURE; + if (!isinf(x)) return EXIT_FAILURE; + if (sign != 1) return EXIT_FAILURE; return EXIT_SUCCESS; } ], - [rb_cv_lgamma_r_m0=yes], - [rb_cv_lgamma_r_m0=no], - [rb_cv_lgamma_r_m0=yes] + [rb_cv_lgamma_r_pm0=yes], + [rb_cv_lgamma_r_pm0=no], + [rb_cv_lgamma_r_pm0=yes] ) ]) - AS_IF([test "x$rb_cv_lgamma_r_m0" = xno], [AC_DEFINE(LGAMMA_R_M0_FIX)]) + AS_IF([test "x$rb_cv_lgamma_r_pm0" = xno], [AC_DEFINE(LGAMMA_R_PM0_FIX)]) ]) # Some platform need -lrt for clock_gettime, but the other don't. Index: ruby_2_3 =================================================================== --- ruby_2_3 (revision 62140) +++ ruby_2_3 (revision 62141) Property changes on: ruby_2_3 ___________________________________________________________________ Modified: svn:mergeinfo ## -0,0 +0,1 ## Merged /trunk:r54803 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/