[Python-checkins] cpython: Return +-Py_HUGE_VAL for tgamma(+-0) instead of risking FP exceptions by
mark.dickinson
python-checkins at python.org
Sun Sep 25 16:35:01 CEST 2011
http://hg.python.org/cpython/rev/7482d0e3476a
changeset: 72467:7482d0e3476a
user: Mark Dickinson <mdickinson at enthought.com>
date: Sun Sep 25 15:26:43 2011 +0100
summary:
Return +-Py_HUGE_VAL for tgamma(+-0) instead of risking FP exceptions by computing 1.0 / 0.0.
files:
Modules/mathmodule.c | 3 ++-
1 files changed, 2 insertions(+), 1 deletions(-)
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c
--- 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 */
--
Repository URL: http://hg.python.org/cpython
More information about the Python-checkins
mailing list