summaryrefslogtreecommitdiffstats
path: root/Objects/complexobject.c
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2001-09-05 14:45:54 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2001-09-05 14:45:54 (GMT)
commit655c9557f6e0da64527cb6f97da65d4b59232c29 (patch)
tree1687a38473130b51b1e762a50fea8104c69461f5 /Objects/complexobject.c
parent0ace326ed2ec73dfa515c89ad06fcddd6fafa4ce (diff)
downloadcpython-655c9557f6e0da64527cb6f97da65d4b59232c29.zip
cpython-655c9557f6e0da64527cb6f97da65d4b59232c29.tar.gz
cpython-655c9557f6e0da64527cb6f97da65d4b59232c29.tar.bz2
Patch #453627: Define the following macros when compiling on a UnixWare 7.x system:
SCO_ATAN2_BUG, SCO_ACCEPT_BUG, and STRICT_SYSV_CURSES. Work aroudn a bug in the SCO UnixWare atan2() implementation.
Diffstat (limited to 'Objects/complexobject.c')
-rw-r--r--Objects/complexobject.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/Objects/complexobject.c b/Objects/complexobject.c
index 7404993..dde6449 100644
--- a/Objects/complexobject.c
+++ b/Objects/complexobject.c
@@ -26,6 +26,22 @@
#define PREC_REPR 17
#define PREC_STR 12
+#ifdef SCO_ATAN2_BUG
+/*
+ * UnixWare 7+ is known to have a bug in atan2 that will return PI instead
+ * of ZERO (0) if the first argument is ZERO(0).
+ */
+static double atan2_sco(double x, double y)
+{
+ if (x == 0.0)
+ return (double)0.0;
+ return atan2(x, y);
+}
+#define ATAN2 atan2_sco
+#else
+#define ATAN2 atan2
+#endif
+
/* elementary operations on complex numbers */
static Py_complex c_1 = {1., 0.};
@@ -138,7 +154,7 @@ c_pow(Py_complex a, Py_complex b)
else {
vabs = hypot(a.real,a.imag);
len = pow(vabs,b.real);
- at = atan2(a.imag, a.real);
+ at = ATAN2(a.imag, a.real);
phase = at*b.real;
if (b.imag != 0.0) {
len /= exp(at*b.imag);