diff Modules/mathmodule.c @ 72467:7482d0e3476a

Return +-Py_HUGE_VAL for tgamma(+-0) instead of risking FP exceptions by computing 1.0 / 0.0.
author Mark Dickinson <mdickinson@enthought.com>
date Sun, 25 Sep 2011 15:26:43 +0100
parents 565f43f6bed4
children b534b56379cb
line wrap: on
line diff
--- a/Modules/mathmodule.c	Sat Sep 24 19:11:53 2011 +0100
+++ b/Modules/mathmodule.c	Sun Sep 25 15:26:43 2011 +0100
@@ -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 */