8000 gh-102221: speed up math.lcm by swapping numbers by kevin1kevin1k · Pull Request #111450 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

gh-102221: speed up math.lcm by swapping numbers #111450

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
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
Update comment of abs value and pr
Co-authored-by: Sergey B Kirpichev <skirpichev@gmail.com>
  • Loading branch information
kevin1kevin1k and skirpichev authored Jun 15, 2025
commit 02c4f1726185287b08ee210174f7e7bc61607b53
2 changes: 1 addition & 1 deletion Modules/mathmodule.c
Original file line number Diff line number Diff line change
Expand Up @@ -770,7 +770,7 @@ long_lcm(PyObject *a, PyObject *b)
return PyLong_FromLong(0);
}

/* Make sure a <= b to speed up (a // g) * b; see #102221 for details. */
/* Make sure |a| <= |b| to speed up (a // g) * b; see gh-102221 for details. */
if (_PyLong_DigitCount((PyLongObject *)b) < _PyLong_DigitCount((PyLongObject *)a)) {
g = a;
a = b;
Expand Down
Loading
0