Skip to content
Snippets Groups Projects
Commit 8a39e18f authored by Damien George's avatar Damien George
Browse files

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

parent 3ed0e5e5
No related branches found
No related tags found
No related merge requests found
...@@ -28,6 +28,7 @@ print(1j / 2) ...@@ -28,6 +28,7 @@ print(1j / 2)
print((1j / 2j).real) print((1j / 2j).real)
print(1j / (1 + 2j)) print(1j / (1 + 2j))
ans = 0j ** 0; print("%.5g %.5g" % (ans.real, ans.imag)) 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 = 0j ** 0j; print("%.5g %.5g" % (ans.real, ans.imag))
ans = 1j ** 2.5; 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)) ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag))
...@@ -94,6 +95,10 @@ except ZeroDivisionError: ...@@ -94,6 +95,10 @@ except ZeroDivisionError:
print("ZeroDivisionError") print("ZeroDivisionError")
# zero division via power # zero division via power
try:
0j ** -1
except ZeroDivisionError:
print("ZeroDivisionError")
try: try:
0j ** 1j 0j ** 1j
except ZeroDivisionError: except ZeroDivisionError:
......
...@@ -75,6 +75,11 @@ try: ...@@ -75,6 +75,11 @@ try:
except ZeroDivisionError: except ZeroDivisionError:
print("ZeroDivisionError") print("ZeroDivisionError")
try:
0.0 ** -1
except ZeroDivisionError:
print("ZeroDivisionError")
# unsupported unary ops # unsupported unary ops
try: try:
......
...@@ -2,3 +2,8 @@ try: ...@@ -2,3 +2,8 @@ try:
1 / 0 1 / 0
except ZeroDivisionError: except ZeroDivisionError:
print("ZeroDivisionError") print("ZeroDivisionError")
try:
0 ** -1
except ZeroDivisionError:
print("ZeroDivisionError")
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment