ruby-changes:42422
From: nobu <ko1@a...>
Date: Wed, 6 Apr 2016 09:21:29 +0900 (JST)
Subject: [ruby-changes:42422] nobu:r54496 (trunk): lgamma_r.c: fix at -0.0
nobu 2016-04-06 10:17:55 +0900 (Wed, 06 Apr 2016) New Revision: 54496 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=54496 Log: lgamma_r.c: fix at -0.0 * math.c (ruby_lgamma_r): missing/lgamma_r.c is used on Windows, since msvcrt does not provide it. * missing/lgamma_r.c (lgamma_r): fix lgamma(-0.0). [ruby-core:74823] [Bug #12249] Modified files: trunk/ChangeLog trunk/math.c trunk/missing/lgamma_r.c Index: ChangeLog =================================================================== --- ChangeLog (revision 54495) +++ ChangeLog (revision 54496) @@ -1,3 +1,11 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Wed Apr 6 10:17:53 2016 cremno phobia <cremno@m...> + + * math.c (ruby_lgamma_r): missing/lgamma_r.c is used on Windows, + since msvcrt does not provide it. + + * missing/lgamma_r.c (lgamma_r): fix lgamma(-0.0). + [ruby-core:74823] [Bug #12249] + Wed Apr 6 01:22:55 2016 NAKAMURA Usaku <usa@r...> * math.c (ruby_lgamma_r): mswin's lgamma_r also seems to be wrong. Index: missing/lgamma_r.c =================================================================== --- missing/lgamma_r.c (revision 54495) +++ missing/lgamma_r.c (revision 54496) @@ -66,7 +66,7 @@ lgamma_r(double x, int *signp) https://github.com/ruby/ruby/blob/trunk/missing/lgamma_r.c#L66 double i, f, s; f = modf(-x, &i); if (f == 0.0) { /* pole error */ - *signp = 1; + *signp = signbit(x) ? -1 : 1; errno = ERANGE; return HUGE_VAL; } Index: math.c =================================================================== --- math.c (revision 54495) +++ math.c (revision 54496) @@ -750,7 +750,7 @@ ruby_tgamma(const double d) https://github.com/ruby/ruby/blob/trunk/math.c#L750 #define tgamma(d) ruby_tgamma(d) #endif -#if defined _WIN32 || defined __APPLE__ +#if defined __APPLE__ static inline double ruby_lgamma_r(const double d, int *sign) { -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/