Skip to content

Commit 7d81917

Browse files
committed
Issue #18513: Add workaround for OS X 10.8 cexp bug that leads to wrong cmath.rect(0.0,-0.0) results.
1 parent c5773c3 commit 7d81917

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

Misc/NEWS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ Core and Builtins
4949
Library
5050
-------
5151

52+
- Issue #18513: Fix behaviour of cmath.rect w.r.t. signed zeros on OS X 10.8 +
53+
gcc.
54+
5255
- Issue #18480: Add missing call to PyType_Ready to the _elementtree extension.
5356

5457
- Issue #17778: Fix test discovery for test_multiprocessing. (Patch by

Modules/cmathmodule.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1006,6 +1006,13 @@ cmath_rect(PyObject *self, PyObject *args)
10061006
else
10071007
errno = 0;
10081008
}
1009+
else if (phi == 0.0) {
1010+
/* Workaround for buggy results with phi=-0.0 on OS X 10.8. See
1011+
bugs.python.org/issue18513. */
1012+
z.real = r;
1013+
z.imag = r * phi;
1014+
errno = 0;
1015+
}
10091016
else {
10101017
z.real = r * cos(phi);
10111018
z.imag = r * sin(phi);

0 commit comments

Comments
 (0)