Maybe not the best way but it'll do for now.
(if (recnum? z)
(let ((ar (real:abs (rec:real-part z)))
(ai (real:abs (rec:imag-part z))))
- (let ((v (real:max ar ai))
- (w (real:min ar ai)))
- (if (real:zero? v)
- v
- (real:* v (real:sqrt (real:1+ (real:square (real:/ w v))))))))
+ (if (and (real:exact? ar)
+ (real:exact? ai))
+ (let ((v (real:max ar ai))
+ (w (real:min ar ai)))
+ (if (real:zero? v)
+ v
+ (real:* v
+ (real:sqrt (real:1+ (real:square (real:/ w v)))))))
+ (flo:hypot (real:->inexact ar) (real:->inexact ai))))
(real:abs z)))
(define (complex:sqrt z)
-inf.0-inf.0i
-inf.0+inf.0i)
(lambda (z)
- (with-expected-failure
- (and (infinite? (real-part z))
- (infinite? (imag-part z))
- 'xfail)
- (lambda ()
- (assert-inf+ (magnitude z))))))
+ (assert-inf+ (magnitude z))))
(define-enumerated-test 'infinite-angle
(vector