summaryrefslogtreecommitdiffstatshomepage
path: root/tests/basics/int_big_mul.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/basics/int_big_mul.py')
-rw-r--r--tests/basics/int_big_mul.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/basics/int_big_mul.py b/tests/basics/int_big_mul.py
index f8d3dcd800..6010075c4e 100644
--- a/tests/basics/int_big_mul.py
+++ b/tests/basics/int_big_mul.py
@@ -6,3 +6,18 @@ for rhs in range(2, 11):
print(lhs, '*', rhs, '=', res)
lhs = res
+# below tests pos/neg combinations that overflow small int
+
+# 31-bit overflow
+i = 1 << 20
+print(i * i)
+print(i * -i)
+print(-i * i)
+print(-i * -i)
+
+# 63-bit overflow
+i = 1 << 40
+print(i * i)
+print(i * -i)
+print(-i * i)
+print(-i * -i)