summaryrefslogtreecommitdiff
path: root/tests/float/complex1.py
diff options
context:
space:
mode:
authorGlenn Ruben Bakke <glennbakke@gmail.com>2017-10-04 21:45:04 +0200
committerGlenn Ruben Bakke <glennbakke@gmail.com>2017-10-04 21:45:04 +0200
commitbcab2ba0a80297100919366add6bada140c6ed75 (patch)
tree5133218f4fc010d5688f006dbdd1e2f346a843f7 /tests/float/complex1.py
parent4468731e3d039a3f72ac25aa43e936cf5ebb3f78 (diff)
parentf869d6b2e339c04469c6c9ea3fb2fabd7bbb2d8c (diff)
ports/nrf: Upmerging port with upstream master
Diffstat (limited to 'tests/float/complex1.py')
-rw-r--r--tests/float/complex1.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/tests/float/complex1.py b/tests/float/complex1.py
index a6038de04..854410545 100644
--- a/tests/float/complex1.py
+++ b/tests/float/complex1.py
@@ -37,6 +37,11 @@ ans = 1j ** 2.5j; print("%.5g %.5g" % (ans.real, ans.imag))
print(1j == 1)
print(1j == 1j)
+# comparison of nan is special
+nan = float('nan') * 1j
+print(nan == 1j)
+print(nan == nan)
+
# builtin abs
print(abs(1j))
print("%.5g" % abs(1j + 2))
@@ -48,6 +53,10 @@ print(type(hash(1j)))
# float on lhs should delegate to complex
print(1.2 + 3j)
+# negative base and fractional power should create a complex
+ans = (-1) ** 2.3; print("%.5g %.5g" % (ans.real, ans.imag))
+ans = (-1.2) ** -3.4; print("%.5g %.5g" % (ans.real, ans.imag))
+
# check printing of inf/nan
print(float('nan') * 1j)
print(float('inf') * (1 + 1j))