From: Taylor R Campbell Date: Tue, 20 Aug 2019 03:13:51 +0000 (+0000) Subject: Test multiplication and division by +i and -i. X-Git-Tag: mit-scheme-pucked-10.1.20~11^2~75 X-Git-Url: https://birchwood-abbey.net/git?a=commitdiff_plain;h=666f9f7d4c7cda604637fbba97fb806dd662ca2a;p=mit-scheme.git Test multiplication and division by +i and -i. We do not currently follow Kahan's recommenations that when the real part is exactly zero, the arithmetic be done by negation rather than multiplication. --- diff --git a/tests/runtime/test-arith.scm b/tests/runtime/test-arith.scm index 61bb26dd0..0cb8243a9 100644 --- a/tests/runtime/test-arith.scm +++ b/tests/runtime/test-arith.scm @@ -256,6 +256,38 @@ USA. (lambda (x y) (assert-nan (* x y)))) +(define-enumerated-test 'i* + (list + (list 3+4i -4+3i) + (list +0. +0.i) + (list -0. -0.i) + (list +0.i -0. expect-failure) + (list -0.i +0.) + (list +0.+0.i -0.+0.i expect-failure) + (list -0.+0.i -0.-0.i expect-failure) + (list +0.-0.i +0.+0.i) + (list -0.-0.i +0.-0.i expect-failure)) + (lambda (z w #!optional xfail) + (with-expected-failure xfail (lambda () (assert-eqv (* +i z) w))) + (with-expected-failure xfail (lambda () (assert-eqv (* z +i) w))) + (with-expected-failure xfail (lambda () (assert-eqv (/ z -i) w))))) + +(define-enumerated-test '/i + (list + (list 3+4i +4-3i) + (list +0. -0.i) + (list -0. +0.i) + (list +0.i +0.) + (list -0.i -0. expect-failure) + (list +0.+0.i +0.-0.i expect-failure) + (list -0.+0.i +0.+0.i) + (list +0.-0.i -0.-0.i expect-failure) + (list -0.-0.i -0.+0.i expect-failure)) + (lambda (z w #!optional xfail) + (with-expected-failure xfail (lambda () (assert-eqv (/ z +i) w))) + (with-expected-failure xfail (lambda () (assert-eqv (* -i z) w))) + (with-expected-failure xfail (lambda () (assert-eqv (* z -i) w))))) + (define-enumerated-test 'polar0-real (list (list 0)