diff options
Diffstat (limited to 'math.c')
-rw-r--r-- | math.c | 14 |
1 files changed, 10 insertions, 4 deletions
@@ -734,14 +734,20 @@ math_erfc(VALUE obj, VALUE x) return DBL2NUM(erfc(Get_Double(x))); } -#ifdef __MINGW32__ +#if defined __MINGW32__ static inline double -mingw_tgamma(const double d) +ruby_tgamma(const double d) { const double g = tgamma(d); - return (isnan(g) && !signbit(d)) ? INFINITY : g; + if (isinf(g)) { + if (d == 0.0 && signbit(d)) return -INFINITY; + } + if (isnan(g)) { + if (!signbit(d)) return INFINITY; + } + return g; } -#define tgamma(d) mingw_tgamma(d) +#define tgamma(d) ruby_tgamma(d) #endif /* |