Open the context
Choose the project folder and name the files or behavior involved.
Compute Fibonacci numbers by fast doubling for integer indices from zero through 10000. Check the first two values, a known larger term and the upper bound, rejecting fractional, negative or Boolean indices.
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 fibonacci(index):
if type(index) is not int or not 0 <= index <= 10000:
raise ValueError("index.range")
a, b = 0, 1
for bit in bin(index)[2:]:
c = a * (2 * b - a)
d = a * a + b * b
a, b = (c, d) if bit == "0" else (d, c + d)
return aThe 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.