commit | 50203a69b344e80be5000fe87aafad09e84cde85 | [log] [tgz] |
---|---|---|
author | Mark Dickinson <mdickinson@enthought.com> | Sun Sep 25 15:26:43 2011 +0100 |
committer | Mark Dickinson <mdickinson@enthought.com> | Sun Sep 25 15:26:43 2011 +0100 |
tree | 37fd4195a22a2a2db62c256ad29a5d1cfa0fb7a4 | |
parent | 36f27c995ad3d8732f51c91f43dacf72823382c6 [diff] |
Return +-Py_HUGE_VAL for tgamma(+-0) instead of risking FP exceptions by computing 1.0 / 0.0.
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index cebb4ff..7e73bfe 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c
@@ -239,7 +239,8 @@ } if (x == 0.0) { errno = EDOM; - return 1.0/x; /* tgamma(+-0.0) = +-inf, divide-by-zero */ + /* tgamma(+-0.0) = +-inf, divide-by-zero */ + return copysign(Py_HUGE_VAL, x); } /* integer arguments */