From: Taylor R Campbell Date: Thu, 8 Nov 2018 08:22:51 +0000 (+0000) Subject: More atan2 edge cases. X-Git-Tag: mit-scheme-pucked-10.1.2~16^2~116^2~10 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=fd613b17c0fa022f88e09c81f7d0d6b6b43128bd;p=mit-scheme.git More atan2 edge cases. --- diff --git a/tests/runtime/test-arith.scm b/tests/runtime/test-arith.scm index ea3dfe836..acffa9c88 100644 --- a/tests/runtime/test-arith.scm +++ b/tests/runtime/test-arith.scm @@ -337,16 +337,32 @@ USA. (define-enumerated-test 'atan2 (vector - (vector +0. -1. (+ (atan 0 -1))) - (vector -0. -1. (- (atan 0 -1))) - (vector +0. -0. (+ (atan 0 -1))) - (vector -0. -0. (- (atan 0 -1))) + (vector +0. -1. +3.1415926535897932) + (vector -0. -1. -3.1415926535897932) + (vector +0. -0. +3.1415926535897932) + (vector -0. -0. -3.1415926535897932) (vector +0. +0. +0.) (vector -0. +0. -0.) (vector +0. +1. +0.) - (vector -0. +1. -0.)) + (vector -0. +1. -0.) + (vector -1. -0. -1.5707963267948966) + (vector -1. +0. -1.5707963267948966) + (vector +1. -0. +1.5707963267948966) + (vector +1. +0. +1.5707963267948966) + (vector -1. (flo:-inf.0) -3.1415926535897932) + (vector +1. (flo:-inf.0) +3.1415926535897932) + (vector -1. (flo:+inf.0) -0.) + (vector +1. (flo:+inf.0) +0.) + (vector (flo:-inf.0) -1. -1.5707963267948966) + (vector (flo:+inf.0) -1. +1.5707963267948966) + (vector (flo:-inf.0) (flo:-inf.0) -2.356194490192345) + (vector (flo:+inf.0) (flo:-inf.0) +2.356194490192345) + (vector (flo:-inf.0) (flo:+inf.0) -.7853981633974483) + (vector (flo:+inf.0) (flo:+inf.0) +.7853981633974483)) (lambda (v) (let ((y (vector-ref v 0)) (x (vector-ref v 1)) (theta (vector-ref v 2))) - (assert-eqv (atan y x) theta)))) \ No newline at end of file + (if (zero? theta) + (assert-eqv (atan y x) theta) + (assert-<= (relerr theta (atan y x)) 1e-15))))) \ No newline at end of file