Skip to content
Snippets Groups Projects
Commit bb4afde9 authored by Raymond Toy's avatar Raymond Toy
Browse files

Fix #22 where coerce was returning the wrong type of float.

src/compiler/float.lisp:
o The deftransform coerce was checking for a type of 'float and using
  %single-float to do the conversion.  This is incorrect; it should
  only apply if the type is 'single-float.

tests/issues.lisp
o Add test for this.

Verified that the test fails on the current snapshot and ix fixed by
this change.
parent e50d75bc
No related branches found
No related tags found
No related merge requests found
......@@ -76,7 +76,7 @@
'(%double-double-float n))
((csubtypep tspec (specifier-type 'double-float))
'(%double-float n))
((csubtypep tspec (specifier-type 'float))
((csubtypep tspec (specifier-type 'single-float))
'(%single-float n))
#+double-double
((csubtypep tspec (specifier-type '(complex double-double-float)))
......
......@@ -200,3 +200,13 @@
tests))
`(progn ,@(nreverse tests)))))
(make-tests)))
(define-test issue.22
(:tag :issues)
(let ((tester (compile nil '(lambda (x)
(coerce x 'float)))))
(assert-eql 1.0 (funcall tester 1))
(assert-eql 2f0 (funcall tester 2f0))
(assert-eql 3d0 (funcall tester 3d0))
(assert-eql 4w0 (funcall tester 4w0))))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment