summaryrefslogtreecommitdiffstats
path: root/Modules/cmathmodule.c
diff options
context:
space:
mode:
authorMark Dickinson <dickinsm@gmail.com>2013-07-20 16:59:13 (GMT)
committerMark Dickinson <dickinsm@gmail.com>2013-07-20 16:59:13 (GMT)
commit58ceecfe5ac0ad436d556b589870dd2df62731c0 (patch)
treeb9303a76865599bf1dec6fb4626b22573419cfc9 /Modules/cmathmodule.c
parent7ed4294d7f821a0733ab47285317f06a8c51e5db (diff)
downloadcpython-58ceecfe5ac0ad436d556b589870dd2df62731c0.zip
cpython-58ceecfe5ac0ad436d556b589870dd2df62731c0.tar.gz
cpython-58ceecfe5ac0ad436d556b589870dd2df62731c0.tar.bz2
Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results.
Diffstat (limited to 'Modules/cmathmodule.c')
-rw-r--r--Modules/cmathmodule.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/Modules/cmathmodule.c b/Modules/cmathmodule.c
index 3021cf0..36bf4a1 100644
--- a/Modules/cmathmodule.c
+++ b/Modules/cmathmodule.c
@@ -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);