diff options
| author | Mark Dickinson <mdickinson@enthought.com> | 2011-09-25 15:26:43 +0100 | 
|---|---|---|
| committer | Mark Dickinson <mdickinson@enthought.com> | 2011-09-25 15:26:43 +0100 | 
| commit | 50203a69b344e80be5000fe87aafad09e84cde85 (patch) | |
| tree | 37fd4195a22a2a2db62c256ad29a5d1cfa0fb7a4 /Modules | |
| parent | 36f27c995ad3d8732f51c91f43dacf72823382c6 (diff) | |
| download | cpython-git-50203a69b344e80be5000fe87aafad09e84cde85.tar.gz | |
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.c | 3 | 
1 files changed, 2 insertions, 1 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index cebb4ff91b..7e73bfed62 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 */  | 
