1 ; tests of complex number arithmetic
4 (check #'= (+ #c
(2 3) #c
(4 2)) #c
(6 5))
5 (check #'= (+ (- #c
(2 3)) #c
(4 2)) #c
(2 -
1))
6 (check #'= (- #c
(2 3) #c
(4 2)) (- #c
(2 -
1)))
7 (check #'= (* (- #c
(3 4)) #c
(1 -
2)) (- #c
(11 -
2)))
8 (check #'< (abs (- (/ #c
(2 1) #c
(1 2)) (/ 4 5) (/ 3 #c
(0 5)))) eps
)
9 (check #'< (abs (- (imagpart (* #c
(3.4
2.5) #c
(3.4 -
2.5))) 0)) eps
)
10 (check #'< (abs (- (abs #c
(2 -
2)) (sqrt 8))) eps
)
11 (check #'< (abs (- (realpart (- #c
(1.77 -
3))) -
1.77)) eps
)
12 (check #'< (abs (- (conjugate #c
(9.03 -
3.6)) #c
(9.03
3.6))) eps
)
13 (check #'< (abs (- (phase #c
(2 2)) (/ pi
4))) eps
)
14 (check #'= (complex 0 7) #c
(0 7))
15 (check #'eql
(if (complexp #c
(4 0)) t nil
) nil
)
16 (check #'eql
(if (complexp #c
(4.5
0)) t nil
) t
)
17 (check #'= (cos (list pi
(* 2 pi
))) (cos (list (- pi
) (- (* 2 pi
)))))