Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results.
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
index 0dc6bdb..5720678 100644
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -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);