]> granicus.if.org Git - python/commitdiff
Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect...
authorMark Dickinson <dickinsm@gmail.com>
Sat, 20 Jul 2013 16:59:13 +0000 (17:59 +0100)
committerMark Dickinson <dickinsm@gmail.com>
Sat, 20 Jul 2013 16:59:13 +0000 (17:59 +0100)
Misc/NEWS
Modules/cmathmodule.c

index de16f7b1de8d259f728f74b9d8eb96fd79eec225..f79f62584aa83cac4aa61490fde851b856e53cde 100644 (file)
--- a/Misc/NEWS
+++ b/Misc/NEWS
@@ -49,6 +49,9 @@ Core and Builtins
 Library
 -------
 
+- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 +
+  gcc.
+
 - Issue #18480: Add missing call to PyType_Ready to the _elementtree extension.
 
 - Issue #17778: Fix test discovery for test_multiprocessing. (Patch by
index 3021cf0466a9ea0ca9c9908c9af672d3830f39f3..36bf4a1e3df8e16230bd4b7b8453fe782cd7ca73 100644 (file)
@@ -1006,6 +1006,13 @@ cmath_rect(PyObject *self, PyObject *args)
         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);