tests/float: Add tests for zero to a negative power.

pull/1/head
Damien George 2017-02-03 00:04:13 +11:00
parent 3ed0e5e5d4
commit 8a39e18f5f
3 changed files with 15 additions and 0 deletions

View File

@ -28,6 +28,7 @@ print(1j / 2)
print((1j / 2j).real)
print(1j / (1 + 2j))
ans = 0j ** 0; print("%.5g %.5g" % (ans.real, ans.imag))
ans = 0j ** 1; print("%.5g %.5g" % (ans.real, ans.imag))
ans = 0j ** 0j; print("%.5g %.5g" % (ans.real, ans.imag))
ans = 1j ** 2.5; print("%.5g %.5g" % (ans.real, ans.imag))
ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag))
@ -94,6 +95,10 @@ except ZeroDivisionError:
print("ZeroDivisionError")
# zero division via power
try:
0j ** -1
except ZeroDivisionError:
print("ZeroDivisionError")
try:
0j ** 1j
except ZeroDivisionError:

View File

@ -75,6 +75,11 @@ try:
except ZeroDivisionError:
print("ZeroDivisionError")
try:
0.0 ** -1
except ZeroDivisionError:
print("ZeroDivisionError")
# unsupported unary ops
try:

View File

@ -2,3 +2,8 @@ try:
1 / 0
except ZeroDivisionError:
print("ZeroDivisionError")
try:
0 ** -1
except ZeroDivisionError:
print("ZeroDivisionError")