diff options
author | Sergey B Kirpichev <skirpichev@gmail.com> | 2024-08-06 12:43:13 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-08-06 12:43:13 (GMT) |
commit | 0b433aa9df6b5bb84e77ff97e59b7bcd04f2199a (patch) | |
tree | 1df0cb50948af76806709edcaccbd5236d6e29c9 /Modules/mathmodule.c | |
parent | 6ff82fdb56fa0381f94c7a45aa67ab4c4aa71930 (diff) | |
download | cpython-0b433aa9df6b5bb84e77ff97e59b7bcd04f2199a.zip cpython-0b433aa9df6b5bb84e77ff97e59b7bcd04f2199a.tar.gz cpython-0b433aa9df6b5bb84e77ff97e59b7bcd04f2199a.tar.bz2 |
gh-122681: merge m_atan2() and c_atan2() helper functions (#122682)
Diffstat (limited to 'Modules/mathmodule.c')
-rw-r--r-- | Modules/mathmodule.c | 37 |
1 files changed, 0 insertions, 37 deletions
diff --git a/Modules/mathmodule.c b/Modules/mathmodule.c index 64dfcea..d6d0702 100644 --- a/Modules/mathmodule.c +++ b/Modules/mathmodule.c @@ -535,43 +535,6 @@ m_lgamma(double x) return r; } -/* - wrapper for atan2 that deals directly with special cases before - delegating to the platform libm for the remaining cases. This - is necessary to get consistent behaviour across platforms. - Windows, FreeBSD and alpha Tru64 are amongst platforms that don't - always follow C99. -*/ - -static double -m_atan2(double y, double x) -{ - if (isnan(x) || isnan(y)) - return Py_NAN; - if (isinf(y)) { - if (isinf(x)) { - if (copysign(1., x) == 1.) - /* atan2(+-inf, +inf) == +-pi/4 */ - return copysign(0.25*Py_MATH_PI, y); - else - /* atan2(+-inf, -inf) == +-pi*3/4 */ - return copysign(0.75*Py_MATH_PI, y); - } - /* atan2(+-inf, x) == +-pi/2 for finite x */ - return copysign(0.5*Py_MATH_PI, y); - } - if (isinf(x) || y == 0.) { - if (copysign(1., x) == 1.) - /* atan2(+-y, +inf) = atan2(+-0, +x) = +-0. */ - return copysign(0., y); - else - /* atan2(+-y, -inf) = atan2(+-0., -x) = +-pi. */ - return copysign(Py_MATH_PI, y); - } - return atan2(y, x); -} - - /* IEEE 754-style remainder operation: x - n*y where n*y is the nearest multiple of y to x, taking n even in the case of a tie. Assuming an IEEE 754 binary floating-point format, the result is always exact. */ |