Commit b8c328b5 authored by Daniel Kochmański's avatar Daniel Kochmański

coerce: allow coercing to si:complex-*-float

Previously coerce didn't understand these atomic specifiers.
parent 19526d40
......@@ -215,13 +215,27 @@
(single-float . (float x 0.0f0))
(double-float . (float x 0.0d0))
(long-float . (float x 0.0l0))
#+complex-float
(si:complex-single-float . (let ((y x))
(declare (:read-only y))
(complex (float (realpart y) 0.0f0)
(float (imagpart y) 0.0f0))))
#+complex-float
(si:complex-double-float . (let ((y x))
(declare (:read-only y))
(complex (float (realpart y) 0.0d0)
(float (imagpart y) 0.0d0))))
#+complex-float
(si:complex-long-float . (let ((y x))
(declare (:read-only y))
(complex (float (realpart y) 0.0l0)
(float (imagpart y) 0.0l0))))
(complex . (let ((y x))
(declare (:read-only y))
(complex (realpart y) (imagpart y))))
(base-char . (character x))
(character . (character x))
(function . (si::coerce-to-function x))
))
(function . (si::coerce-to-function x))))
(defun expand-coerce (form value type env)
(declare (si::c-local))
......
......@@ -768,6 +768,18 @@ if not possible."
(DOUBLE-FLOAT (float object 0.0D0))
(LONG-FLOAT (float object 0.0L0))
(COMPLEX (complex (realpart object) (imagpart object)))
#+complex-float
(si:complex-single-float
(complex (coerce (realpart object) 'single-float)
(coerce (imagpart object) 'single-float)))
#+complex-float
(si:complex-double-float
(complex (coerce (realpart object) 'double-float)
(coerce (imagpart object) 'double-float)))
#+complex-float
(si:complex-long-float
(complex (coerce (realpart object) 'long-float)
(coerce (imagpart object) 'long-float)))
(FUNCTION (coerce-to-function object))
((VECTOR SIMPLE-VECTOR #+unicode SIMPLE-BASE-STRING SIMPLE-STRING
#+unicode BASE-STRING STRING BIT-VECTOR SIMPLE-BIT-VECTOR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment