diff --git a/configure.in b/configure.in index 76eb9accec..1ca8d142ac 100644 --- a/configure.in +++ b/configure.in @@ -1317,7 +1317,6 @@ main() ac_cv_func___builtin_setjmp=no ac_cv_func_round=no ]) - ac_cv_func_tgamma=no AC_CHECK_TYPE([NET_LUID], [], [], [@%:@include @%:@include ]) diff --git a/math.c b/math.c index 570776baef..6a55966c49 100644 --- a/math.c +++ b/math.c @@ -869,7 +869,13 @@ math_gamma(VALUE unused_obj, VALUE x) double d; d = Get_Double(x); /* check for domain error */ - if (isinf(d) && signbit(d)) domain_error("gamma"); + if (isinf(d)) { + if (signbit(d)) domain_error("gamma"); + return DBL2NUM(INFINITY); + } + if (d == 0.0) { + return signbit(d) ? DBL2NUM(-INFINITY) : DBL2NUM(INFINITY); + } if (d == floor(d)) { if (d < 0.0) domain_error("gamma"); if (1.0 <= d && d <= (double)NFACT_TABLE) {