8000 gh-122681: remove m_atan2()/c_atan2() helpers by skirpichev · Pull Request #122715 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-122681: remove m_atan2()/c_atan2() helpers #122715

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Aug 17, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Merge branch 'master' into remove-atan2-helpers-122681
  • Loading branch information
skirpichev committed Aug 6, 2024
commit a4aff45238766e452248e0a257ba86218005194f
39 changes: 0 additions & 39 deletions Modules/_math.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,42 +23,3 @@ _Py_log1p(double x)
}

#define m_log1p _Py_log1p

/*
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. Windows screws up atan2 for inf and nan, and
alpha Tru64 5.1 doesn't follow C99 for atan2(0., 0.).
*/

static double
_Py_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);
}

#define m_atan2 _Py_atan2
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.
0