mirror of
https://github.com/micropython/micropython.git
synced 2026-01-08 05:00:26 +01:00
py: Implement raising a big-int to a negative power.
Before this patch raising a big-int to a negative power would just return 0. Now it returns a floating-point number with the correct value.
This commit is contained in:
@@ -18,6 +18,10 @@ print("%.5g" % (i / 1.2))
|
||||
# this should delegate to complex
|
||||
print("%.5g" % (i * 1.2j).imag)
|
||||
|
||||
# negative power should produce float
|
||||
print("%.5g" % (i ** -1))
|
||||
print("%.5g" % ((2 + i - i) ** -3))
|
||||
|
||||
try:
|
||||
i / 0
|
||||
except ZeroDivisionError:
|
||||
|
||||
Reference in New Issue
Block a user