1.0.14.32: fix bug 407
authorNikodemus Siivola <nikodemus@random-state.net>
Sun, 17 Feb 2008 13:26:15 +0000 (13:26 +0000)
committerNikodemus Siivola <nikodemus@random-state.net>
Sun, 17 Feb 2008 13:26:15 +0000 (13:26 +0000)
 * %SINGLE-FLOAT and %DOUBLE-FLOAT should not be flushable.

 * BUGS entry remains: should (COERCE (EXPT 2 1024) 'SINGLE-FLOAT)
   really signal a TYPE-ERROR?

BUGS
src/compiler/float-tran.lisp
tests/float.impure.lisp
version.lisp-expr

diff --git a/BUGS b/BUGS
index 887ffbe..4c64490 100644 (file)
--- a/BUGS
+++ b/BUGS
@@ -1713,6 +1713,10 @@ WORKAROUND:
                3: (SB-C::BOUND-FUNC ...)
                4: (SB-C::%SINGLE-FLOAT-DERIVE-TYPE-AUX ...)
 
+  These are now fixed, but (COERCE HUGE 'SINGLE-FLOAT) still signals a
+  type-error at runtime. The question is, should it instead signal a
+  floating-point overflow, or return an infinity?
+
 408: SUBTYPEP confusion re. OR of SATISFIES of not-yet-defined predicate
        As reported by Levente M\'{e}sz\'{a}ros sbcl-devel 2006-02-20,
                (aver (equal (multiple-value-list
index a4672e5..b05138a 100644 (file)
@@ -15,8 +15,8 @@
 \f
 ;;;; coercions
 
-(defknown %single-float (real) single-float (movable foldable flushable))
-(defknown %double-float (real) double-float (movable foldable flushable))
+(defknown %single-float (real) single-float (movable foldable))
+(defknown %double-float (real) double-float (movable foldable))
 
 (deftransform float ((n f) (* single-float) *)
   '(%single-float n))
                 (specifier-type `(,',type ,(or lo '*) ,(or hi '*)))))
 
             (defoptimizer (,fun derive-type) ((num))
-              (one-arg-derive-type num #',aux-name #',fun))))))
+              (handler-case
+                  (one-arg-derive-type num #',aux-name #',fun)
+                (type-error ()
+                  nil)))))))
   (frob %single-float single-float
         most-negative-single-float most-positive-single-float)
   (frob %double-float double-float
index 04609a4..aad98f5 100644 (file)
 (defun new-pu-label-from-pu-labels (array)
   (setf (aref (the myarraytype array) 0)
         sb-ext:double-float-positive-infinity))
+
+;;; bug 407
+;;;
+;;; FIXME: it may be that TYPE-ERROR is wrong, and we should
+;;; instead signal an overflow or coerce into an infinity.
+(defun bug-407a ()
+  (loop for n from (expt 2 1024) upto (+ 10 (expt 2 1024))
+        do (handler-case
+               (coerce n 'single-float)
+             (simple-type-error ()
+               (return-from bug-407a :type-error)))))
+(assert (eq :type-error (bug-407a)))
+(defun bug-407b ()
+  (loop for n from (expt 2 1024) upto (+ 10 (expt 2 1024))
+        do (handler-case
+               (format t "~E~%" (coerce n 'single-float))
+             (simple-type-error ()
+               (return-from bug-407b :type-error)))))
+(assert (eq :type-error (bug-407b)))
index 47934f2..1690451 100644 (file)
@@ -17,4 +17,4 @@
 ;;; checkins which aren't released. (And occasionally for internal
 ;;; versions, especially for internal versions off the main CVS
 ;;; branch, it gets hairier, e.g. "0.pre7.14.flaky4.13".)
-"1.0.14.31"
+"1.0.14.32"