attempt to fix float-complex

This commit is contained in:
Spencer Florence 2017-07-09 13:04:19 -05:00 committed by Vincent St-Amour
parent e188551b19
commit c75779b1a1

View File

@ -570,11 +570,18 @@
#`(let*-values (c.bindings ...)
;; reuses the algorithm used by the Racket runtime
(let*-values ([(r) (unsafe-flabs c.real-binding)]
[(i) (unsafe-flabs c.imag-binding)]
[(q) (unsafe-fl/ r i)])
(unsafe-fl* i
(unsafe-flsqrt (unsafe-fl+ 1.0
(unsafe-fl* q q))))))])))
[(i) (unsafe-flabs c.imag-binding)])
(if (zero? i)
r
(if (unsafe-fl< i r)
(let-values ([(q) (unsafe-fl/ i r)])
(unsafe-fl* r
(unsafe-flsqrt (unsafe-fl+ 1.0
(unsafe-fl* q q)))))
(let-values ([(q) (unsafe-fl/ r i)])
(unsafe-fl* i
(unsafe-flsqrt (unsafe-fl+ 1.0
(unsafe-fl* q q)))))))))])))
(pattern (#%plain-app op:float-complex-op e:expr ...)