Open the context
Choose the project folder and name the files or behavior involved.
Return nonnegative gcd and Bézout coefficients for two integers with fewer than 101 decimal digits. Test negative operands and both zero cases, verifying the integer identity and rejecting Boolean inputs.
Choose the project folder and name the files or behavior involved.
Describe the input, expected output and boundaries that must stay intact.
Review the proposed edits and any commands before relying on their result.
Compare actual behavior with the expected result. If a check fails, investigate it before applying more changes.
def bezout(a, b):
if any(type(v) is not int or abs(v) >= 10**100 for v in (a, b)):
raise ValueError("integer.range")
old_r, r = abs(a), abs(b)
old_s, s, old_t, t = 1, 0, 0, 1
while r:
q = old_r // r
old_r, r = r, old_r - q * r
old_s, s = s, old_s - q * s
old_t, t = t, old_t - q * t
return old_r, old_s * (-1 if a < 0 else 1), old_t * (-1 if b < 0 else 1)The example is a starting point for a real project, not a claim that generated code is already tested. Adjust paths, dependencies and expected behavior to match your application.