ruby-changes:37832
From: nobu <ko1@a...>
Date: Tue, 10 Mar 2015 13:54:00 +0900 (JST)
Subject: [ruby-changes:37832] nobu:r49913 (trunk): math.c: fix tgamma on mingw
nobu 2015-03-10 13:53:46 +0900 (Tue, 10 Mar 2015) New Revision: 49913 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49913 Log: math.c: fix tgamma on mingw * math.c (mingw_tgamma): tgamma(3) on mingw returns a NaN for a big number, not infinity. Modified files: trunk/math.c Index: math.c =================================================================== --- math.c (revision 49912) +++ math.c (revision 49913) @@ -786,6 +786,16 @@ math_erfc(VALUE obj, VALUE x) https://github.com/ruby/ruby/blob/trunk/math.c#L786 return DBL2NUM(erfc(Get_Double(x))); } +#ifdef __MINGW32__ +static inline double +mingw_tgamma(const double d) +{ + const double g = tgamma(d); + return (isnan(g) && !signbit(d)) ? INFINITY : g; +} +#define tgamma(d) mingw_tgamma(d) +#endif + /* * call-seq: * Math.gamma(x) -> Float -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/