From cce645e6a7b1819922c3e9fa2c5bff0bc6d5dfa5 Mon Sep 17 00:00:00 2001 From: usa Date: Wed, 31 Jan 2018 13:47:33 +0000 Subject: 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_3@62141 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- math.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'math.c') diff --git a/math.c b/math.c index 9ac898f0ba..c3fe7dbd09 100644 --- a/math.c +++ b/math.c @@ -750,7 +750,7 @@ ruby_tgamma(const double d) #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) if (d == 0.0 && signbit(d)) { *sign = -1; return INFINITY; + } else if (d == 0.0 && !signbit(d)) { + *sign = 1; + return INFINITY; } } return g; -- cgit v1.2.3