mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
math.c: fix tgamma on mingw
* math.c (mingw_tgamma): tgamma(3) on mingw returns a NaN for a big number, not infinity. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49913 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
c5c5e96643
commit
3f6fb5f72a
1 changed files with 10 additions and 0 deletions
10
math.c
10
math.c
|
@ -786,6 +786,16 @@ math_erfc(VALUE obj, VALUE x)
|
|||
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
|
||||
|
|
Loading…
Add table
Reference in a new issue