[Git][cmucl/cmucl][master] Fix #22 where coerce was returning the wrong type of float.
Raymond Toy
rtoy at common-lisp.net
Sat May 14 02:17:17 UTC 2016
Raymond Toy pushed to branch master at cmucl / cmucl
Commits:
bb4afde9 by Raymond Toy at 2016-05-13T17:37:58-07:00
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.
- - - - -
2 changed files:
- src/compiler/float-tran.lisp
- tests/issues.lisp
Changes:
=====================================
src/compiler/float-tran.lisp
=====================================
--- a/src/compiler/float-tran.lisp
+++ b/src/compiler/float-tran.lisp
@@ -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)))
=====================================
tests/issues.lisp
=====================================
--- a/tests/issues.lisp
+++ b/tests/issues.lisp
@@ -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))))
+
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/commit/bb4afde9814ae938cc7f8de539328a1619f6fa30
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.common-lisp.net/pipermail/cmucl-cvs/attachments/20160514/48608bfa/attachment.html>
More information about the cmucl-cvs
mailing list