[Python-checkins] CVS: python/dist/src/Modules cmathmodule.c,2.24,2.25 mathmodule.c,2.63,2.64
Martin v. L?wis
loewis@users.sourceforge.net
Wed, 05 Sep 2001 07:45:56 -0700
Update of /cvsroot/python/python/dist/src/Modules
In directory usw-pr-cvs1:/tmp/cvs-serv12367/Modules
Modified Files:
cmathmodule.c mathmodule.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: cmathmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/cmathmodule.c,v
retrieving revision 2.24
retrieving revision 2.25
diff -C2 -d -r2.24 -r2.25
*** cmathmodule.c 2001/02/22 19:51:56 2.24
--- cmathmodule.c 2001/09/05 14:45:54 2.25
***************
*** 22,25 ****
--- 22,41 ----
#endif
+ #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
+
/* First, the C functions that do the real work */
***************
*** 173,177 ****
Py_complex r;
double l = hypot(x.real,x.imag);
! r.imag = atan2(x.imag, x.real);
r.real = log(l);
return r;
--- 189,193 ----
Py_complex r;
double l = hypot(x.real,x.imag);
! r.imag = ATAN2(x.imag, x.real);
r.real = log(l);
return r;
***************
*** 189,193 ****
Py_complex r;
double l = hypot(x.real,x.imag);
! r.imag = atan2(x.imag, x.real)/log(10.);
r.real = log10(l);
return r;
--- 205,209 ----
Py_complex r;
double l = hypot(x.real,x.imag);
! r.imag = ATAN2(x.imag, x.real)/log(10.);
r.real = log10(l);
return r;
Index: mathmodule.c
===================================================================
RCS file: /cvsroot/python/python/dist/src/Modules/mathmodule.c,v
retrieving revision 2.63
retrieving revision 2.64
diff -C2 -d -r2.63 -r2.64
*** mathmodule.c 2001/09/05 04:33:11 2.63
--- mathmodule.c 2001/09/05 14:45:54 2.64
***************
*** 32,35 ****
--- 32,51 ----
#endif
+ #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
+
/* Call is_error when errno != 0, and where x is the result libm
* returned. is_error will usually set up an exception and return
***************
*** 116,120 ****
FUNC1(atan, atan,
"atan(x)\n\nReturn the arc tangent (measured in radians) of x.")
! FUNC2(atan2, atan2,
"atan2(y, x)\n\nReturn the arc tangent (measured in radians) of y/x.\n"
"Unlike atan(y/x), the signs of both x and y are considered.")
--- 132,136 ----
FUNC1(atan, atan,
"atan(x)\n\nReturn the arc tangent (measured in radians) of x.")
! FUNC2(atan2, ATAN2,
"atan2(y, x)\n\nReturn the arc tangent (measured in radians) of y/x.\n"
"Unlike atan(y/x), the signs of both x and y are considered.")