diff options
author | Martin v. Löwis <martin@v.loewis.de> | 2001-09-05 14:45:54 (GMT) |
---|---|---|
committer | Martin v. Löwis <martin@v.loewis.de> | 2001-09-05 14:45:54 (GMT) |
commit | 655c9557f6e0da64527cb6f97da65d4b59232c29 (patch) | |
tree | 1687a38473130b51b1e762a50fea8104c69461f5 /Modules/mathmodule.c | |
parent | 0ace326ed2ec73dfa515c89ad06fcddd6fafa4ce (diff) | |
download | cpython-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 'Modules/mathmodule.c')
-rw-r--r-- | Modules/mathmodule.c | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index c206ddc..7f4839a 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -31,6 +31,22 @@ extern double modf (double, double *); #define CHECK(x) /* Don't know how to check */ #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 * true (1), but may return false (0) without setting up an exception. @@ -115,7 +131,7 @@ FUNC1(asin, asin, "asin(x)\n\nReturn the arc sine (measured in radians) of x.") FUNC1(atan, atan, "atan(x)\n\nReturn the arc tangent (measured in radians) of x.") -FUNC2(atan2, atan2, +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.") FUNC1(ceil, ceil, |