The imaginary part of a non-complex is exact 0.

This commit is contained in:
Alex Shinn 2012-12-21 21:39:23 +09:00
parent e4b86a5807
commit 11cdc6930d

View file

@ -1080,7 +1080,7 @@
(cond-expand
(complex
(define (real-part z) (if (%complex? z) (complex-real z) z))
(define (imag-part z) (if (%complex? z) (complex-imag z) 0.0))
(define (imag-part z) (if (%complex? z) (complex-imag z) 0))
(define (magnitude z)
(sqrt (+ (* (real-part z) (real-part z))
(* (imag-part z) (imag-part z)))))