diff Modules/cmathmodule.c @ 84740:91374660355a 2.7

Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results.
author Raymond Hettinger <python@rcn.com>
date Sat, 20 Jul 2013 10:56:58 -0700
parents cd8d3c2d3bce
children
line wrap: on
line diff
--- a/Modules/cmathmodule.c	Tue Jul 16 22:11:28 2013 +0300
+++ b/Modules/cmathmodule.c	Sat Jul 20 10:56:58 2013 -0700
@@ -1006,6 +1006,13 @@
         else
             errno = 0;
     }
+    else if (phi == 0.0) {
+        /* Workaround for buggy results with phi=-0.0 on OS X 10.8.  See
+           bugs.python.org/issue18513. */
+        z.real = r;
+        z.imag = r * phi;
+        errno = 0;
+    }
     else {
         z.real = r * cos(phi);
         z.imag = r * sin(phi);