--- /dev/null
+Bug fix: (angle z) now correctly handles edge cases with signed zero.
\f
(define (complex:angle z)
(cond ((recnum? z)
- (if (and (real:zero? (rec:real-part z))
+ (if (and (complex:exact? z)
+ (real:zero? (rec:real-part z))
(real:zero? (rec:imag-part z)))
- (real:0 (complex:exact? z))
+ 0
(real:atan2 (rec:imag-part z) (rec:real-part z))))
- ((real:negative? z) rec:pi)
+ ((real:sign-negative? z) rec:pi)
(else (real:0 (real:exact? z)))))
(define (complex:magnitude z)
(list 0 0)
(list 0. 0.)
(list +0.i 0.)
- (list -0.i -0. expect-failure)
+ (list -0.i -0.)
(list +0.+0.i 0.)
- (list +0.-0.i -0. expect-failure)
+ (list +0.-0.i -0.)
;; angle(+inf +/- y i) = +/- 0 for finite y
(list +inf.0 0.) ;XXX Why not exact, if imag-part is exact 0?
(list +inf.0+0.i 0.)
(list -inf.0+i pi)
(list -inf.0-i (- pi))
;; angle(-0 +/- 0i) = +/- pi
- (list -0. pi expect-failure)
- (list -0.+0.i pi expect-failure)
- (list -0.-0.i (- pi) expect-failure))
+ (list -0. pi)
+ (list -0.+0.i pi)
+ (list -0.-0.i (- pi)))
(lambda (z t #!optional xfail)
(with-expected-failure xfail
(lambda ()