summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test-suite/tests/numbers.test47
1 files changed, 47 insertions, 0 deletions
diff --git a/test-suite/tests/numbers.test b/test-suite/tests/numbers.test
index c4bb04432..880ffdddf 100644
--- a/test-suite/tests/numbers.test
+++ b/test-suite/tests/numbers.test
@@ -2431,6 +2431,53 @@
(and (= x (round x))
(exact? (round x))))))
+ (with-test-prefix "frac"
+ (define (=exact x y)
+ (and (= x y)
+ (exact? y)))
+
+ (pass-if (=exact -2 (round -7/3)))
+ (pass-if (=exact -2 (round -5/3)))
+ (pass-if (=exact -1 (round -4/3)))
+ (pass-if (=exact -1 (round -2/3)))
+ (pass-if (=exact 0 (round -1/3)))
+ (pass-if (=exact 0 (round 1/3)))
+ (pass-if (=exact 1 (round 2/3)))
+ (pass-if (=exact 1 (round 4/3)))
+ (pass-if (=exact 2 (round 5/3)))
+ (pass-if (=exact 2 (round 7/3)))
+
+ (pass-if (=exact -3 (round -17/6)))
+ (pass-if (=exact -3 (round -16/6)))
+ (pass-if (=exact -2 (round -15/6)))
+ (pass-if (=exact -2 (round -14/6)))
+ (pass-if (=exact -2 (round -13/6)))
+ (pass-if (=exact -2 (round -11/6)))
+ (pass-if (=exact -2 (round -10/6)))
+ (pass-if (=exact -2 (round -9/6)))
+ (pass-if (=exact -1 (round -8/6)))
+ (pass-if (=exact -1 (round -7/6)))
+ (pass-if (=exact -1 (round -5/6)))
+ (pass-if (=exact -1 (round -4/6)))
+ (pass-if (=exact 0 (round -3/6)))
+ (pass-if (=exact 0 (round -2/6)))
+ (pass-if (=exact 0 (round -1/6)))
+ (pass-if (=exact 0 (round 1/6)))
+ (pass-if (=exact 0 (round 2/6)))
+ (pass-if (=exact 0 (round 3/6)))
+ (pass-if (=exact 1 (round 4/6)))
+ (pass-if (=exact 1 (round 5/6)))
+ (pass-if (=exact 1 (round 7/6)))
+ (pass-if (=exact 1 (round 8/6)))
+ (pass-if (=exact 2 (round 9/6)))
+ (pass-if (=exact 2 (round 10/6)))
+ (pass-if (=exact 2 (round 11/6)))
+ (pass-if (=exact 2 (round 13/6)))
+ (pass-if (=exact 2 (round 14/6)))
+ (pass-if (=exact 2 (round 15/6)))
+ (pass-if (=exact 3 (round 16/6)))
+ (pass-if (=exact 3 (round 17/6))))
+
(with-test-prefix "real"
(pass-if "0.0"
(and (= 0.0 (round 0.0))