summaryrefslogtreecommitdiffstats
path: root/Modules
diff options
context:
space:
mode:
authorMark Dickinson <mdickinson@enthought.com>2011-09-25 14:26:43 (GMT)
committerMark Dickinson <mdickinson@enthought.com>2011-09-25 14:26:43 (GMT)
commit50203a69b344e80be5000fe87aafad09e84cde85 (patch)
tree37fd4195a22a2a2db62c256ad29a5d1cfa0fb7a4 /Modules
parent36f27c995ad3d8732f51c91f43dacf72823382c6 (diff)
downloadcpython-50203a69b344e80be5000fe87aafad09e84cde85.zip
cpython-50203a69b344e80be5000fe87aafad09e84cde85.tar.gz
cpython-50203a69b344e80be5000fe87aafad09e84cde85.tar.bz2
Return +-Py_HUGE_VAL for tgamma(+-0) instead of risking FP exceptions by computing 1.0 / 0.0.
Diffstat (limited to 'Modules')
-rw-r--r--Modules/mathmodule.c3
1 files changed, 2 insertions, 1 deletions
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 @@ m_tgamma(double x)
}
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 */