-
-
Notifications
You must be signed in to change notification settings - Fork 33.1k
Closed as not planned
Closed as not planned
Copy link
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error
Description
Bug report
Bug description:
I want to transpose the code in C++ but I discovered a problem in Python code.
Here is the sample test:
a = 561453*2**64 + 13205*2**32 + 1564
b = 1698*2**32 + 721
q = 330*2**32 + 2815252282
r = 414*2**32 + 1722637250
print("a", a)
print("b", b)
print("q", q)
print("r", r)
q_, r_ = int_divmod(a, b)
print("q_", q_)
print("r_", r_)
If I comment lines 435 and 436 for testing:
if a.bit_length() - n <= _DIV_LIMIT:
return divmod(a, b)
I obtained an infinite loop and I don't understand why.
Is the algorithm work on an existing test?
CPython versions tested on:
3.12
Operating systems tested on:
Windows
Metadata
Metadata
Assignees
Labels
type-bugAn unexpected behavior, bug, or errorAn unexpected behavior, bug, or error