From 50203a69b344e80be5000fe87aafad09e84cde85 Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Sun, 25 Sep 2011 15:26:43 +0100 Subject: Return +-Py_HUGE_VAL for tgamma(+-0) instead of risking FP exceptions by computing 1.0 / 0.0. --- Modules/mathmodule.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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 */ -- cgit v0.12