summaryrefslogtreecommitdiff
path: root/tests/float/float_divmod_relaxed.py
diff options
context:
space:
mode:
Diffstat (limited to 'tests/float/float_divmod_relaxed.py')
-rw-r--r--tests/float/float_divmod_relaxed.py4
1 files changed, 3 insertions, 1 deletions
diff --git a/tests/float/float_divmod_relaxed.py b/tests/float/float_divmod_relaxed.py
index a9450fa2c..ef5a6ad2e 100644
--- a/tests/float/float_divmod_relaxed.py
+++ b/tests/float/float_divmod_relaxed.py
@@ -4,10 +4,12 @@
# pyboard has 32-bit floating point and gives different (but still
# correct) answers for certain combinations of divmod arguments.
+
def test(x, y):
div, mod = divmod(x, y)
print(div == x // y, mod == x % y, abs(div * y + mod - x) < 1e-6)
+
test(1.23456, 0.7)
test(-1.23456, 0.7)
test(1.23456, -0.7)
@@ -30,4 +32,4 @@ for i in range(25):
try:
divmod(1.0, 0)
except ZeroDivisionError:
- print('ZeroDivisionError')
+ print("ZeroDivisionError")