]> granicus.if.org Git - python/commitdiff
Return +-Py_HUGE_VAL for tgamma(+-0) instead of risking FP exceptions by computing...
authorMark Dickinson <mdickinson@enthought.com>
Sun, 25 Sep 2011 14:26:43 +0000 (15:26 +0100)
committerMark Dickinson <mdickinson@enthought.com>
Sun, 25 Sep 2011 14:26:43 +0000 (15:26 +0100)
Modules/mathmodule.c

index cebb4ff91ba58e6dc25b5196e28643809fe3c389..7e73bfed62b5a4c8de9ee9beca8e11baf938499b 100644 (file)
@@ -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 */