return int(a * b)
@cython.overflowcheck(True)
-def test_nested(INT a, INT b, INT c):
+def test_nested_add(INT a, INT b, INT c):
"""
- >>> test_nested(1, 2, 3)
+ >>> test_nested_add(1, 2, 3)
6
- >>> expect_overflow(test_nested, half + 1, half + 1, half + 1)
- >>> expect_overflow(test_nested, half - 1, half - 1, half - 1)
+ >>> expect_overflow(test_nested_add, half + 1, half + 1, half + 1)
+ >>> expect_overflow(test_nested_add, half - 1, half - 1, half - 1)
"""
return int(a + b + c)
return value
@cython.overflowcheck(True)
+def test_nested(INT a, INT b, INT c, INT d):
+ """
+ >>> test_nested_func(1, 2, 3)
+ called(5)
+ 6
+ >>> expect_overflow(test_nested, half, half, 1, 1)
+ >>> expect_overflow(test_nested, half, 1, half, half)
+ >>> expect_overflow(test_nested, half, 2, half, 2)
+
+ >>> print(format(test_nested(half, 2, 0, 1)))
+ half + half - 0
+ >>> print(format(test_nested(1, 0, half, 2)))
+ half + half - 0
+ >>> print(format(test_nested(half, 1, 1, half)))
+ half + half - 0
+ """
+ return int(a * b + c * d)
+
+@cython.overflowcheck(True)
def test_nested_func(INT a, INT b, INT c):
"""
>>> test_nested_func(1, 2, 3)
>>> print(format(test_nested_func(1, half - 1, half - 1)))
called(half + half - 2)
half + half - 1
- >>>
"""
return int(a + called(b + c))