[Python-checkins] CVS: python/dist/src/Objects complexobject.c,2.42,2.43
Martin v. L?wis
loewis@users.sourceforge.net
Wed, 05 Sep 2001 07:45:56 -0700
Update of /cvsroot/python/python/dist/src/Objects
In directory usw-pr-cvs1:/tmp/cvs-serv12367/Objects
Modified Files:
complexobject.c
Log Message:
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.
Index: complexobject.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Objects/complexobject.c,v
retrieving revision 2.42
retrieving revision 2.43
diff -C2 -d -r2.42 -r2.43
*** complexobject.c 2001/09/04 05:14:19 2.42
--- complexobject.c 2001/09/05 14:45:54 2.43
***************
*** 27,30 ****
--- 27,46 ----
#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 */
***************
*** 139,143 ****
vabs = hypot(a.real,a.imag);
len = pow(vabs,b.real);
! at = atan2(a.imag, a.real);
phase = at*b.real;
if (b.imag != 0.0) {
--- 155,159 ----
vabs = hypot(a.real,a.imag);
len = pow(vabs,b.real);
! at = ATAN2(a.imag, a.real);
phase = at*b.real;
if (b.imag != 0.0) {