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:
Damien George
2017-07-25 11:49:22 +10:00
parent 4d1fb6107f
commit 04552ff71b
5 changed files with 19 additions and 4 deletions

View File

@@ -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: