From 77fcad5e3570a40abb2ba962e8768e7c4102cb3e Mon Sep 17 00:00:00 2001 From: Taylor R Campbell Date: Sun, 18 Nov 2018 05:17:32 +0000 Subject: [PATCH] Add some atan tests. Currently (atan -2i) is broken because of an unfortunate consequence of exact Scheme arithmetic failing to propagate sign changes through zero like floating-point does. --- tests/runtime/test-arith.scm | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/tests/runtime/test-arith.scm b/tests/runtime/test-arith.scm index c93f276d5..7ee2b6371 100644 --- a/tests/runtime/test-arith.scm +++ b/tests/runtime/test-arith.scm @@ -472,4 +472,24 @@ USA. (flo:nan.0) (flo:+inf.0) (flo:-inf.0)) - assert-not-integer) \ No newline at end of file + assert-not-integer) + +(define-test 'atan-0 + (lambda () + (assert-eqv (atan 0) 0))) + +(define-enumerated-test 'atan + (vector + (vector +2i +1.5707963267948966+.5493061443340549i) + (vector +0.+2i +1.5707963267948966+.5493061443340549i) + (vector -0.+2i -1.5707963267948966+.5493061443340549i) + (vector -2i +1.5707963267948966-.5493061443340549i 'xfail) + (vector +0.-2i +1.5707963267948966-.5493061443340549i) + (vector -0.-2i -1.5707963267948966-.5493061443340549i)) + (lambda (v) + (let ((x (vector-ref v 0)) + (t (vector-ref v 1)) + (xfail? (if (<= 3 (vector-length v)) (vector-ref v 2) #f))) + (with-expected-failure xfail? + (lambda () + (assert-<= (relerr t (atan x)) 1e-15)))))) \ No newline at end of file -- 2.25.1