From: Taylor R Campbell Date: Sun, 18 Nov 2018 05:17:32 +0000 (+0000) Subject: Add some atan tests. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~29 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=77fcad5e3570a40abb2ba962e8768e7c4102cb3e;p=mit-scheme.git 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. --- 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