8000 bpo-44698: Restore complex pow behaviour for small integral exponents by mdickinson · Pull Request #27772 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

bpo-44698: Restore complex pow behaviour for small integral exponents #27772

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
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
Use 'floor' rather than 'rint', just in case there are platforms that…
… have floor but not rint
  • Loading branch information
mdickinson committed Aug 15, 2021
commit c03c9a5aaaa7b61868a0f833c195aae07191f548
2 changes: 1 addition & 1 deletion Objects/complexobject.c
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,7 @@ complex_pow(PyObject *v, PyObject *w, PyObject *z)
}
errno = 0;
exponent = b;
if (exponent.imag == 0.0 && exponent.real == rint(exponent.real)
if (exponent.imag == 0.0 && exponent.real == floor(exponent.real)
&& fabs(exponent.real) <= 100.0) {
p = c_powi(a, (long)exponent.real);
}
Expand Down
0