diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-10 04:53:46 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-03-10 04:53:46 +0000 |
commit | 3f6fb5f72ad2a4a911518ab47e260089e9e4089a (patch) | |
tree | 0815f7950cdfdb2c335c4f50a34bf503ac1d9307 /math.c | |
parent | c5c5e96643fd674cc44bf6c4f6edd965aa317c9e (diff) | |
download | ruby-3f6fb5f72ad2a4a911518ab47e260089e9e4089a.tar.gz |
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
Diffstat (limited to 'math.c')
-rw-r--r-- | math.c | 10 |
1 files changed, 10 insertions, 0 deletions
@@ -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 |