We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8fa26e5 commit ed23926Copy full SHA for ed23926
recursion.py
@@ -49,7 +49,7 @@ def binary_power(a, n, unit=1, verbose=False):
49
if n < 0:
50
return Fraction(1, binary_power(a, -n, unit, verbose))
51
elif n == 0:
52
- result = 1
+ result = unit
53
else:
54
result = binary_power(a, n // 2, unit, verbose)
55
result = result * result * (a if n % 2 == 1 else unit)
0 commit comments