(reported by Ariel Badichi on sbcl-devel 2007-01-09)
407a: In sbcl-1.0.1 on Linux x86,
(defun foo ()
(loop for n from (expt 2 1024) do (handler-case (coerce n 'single-float) (simple-type-error () (format t "Got here.~%") (return-from foo)))))
(foo)
causes an infinite loop, where handling the error would be expected.
407b: In sbcl-1.0.1 on Linux x86,
(defun bar ()
(loop for n from (expt 2 1024) do (handler-case (format t "~E~%" (coerce n 'single-float)) (simple-type-error () (format t "Got here.~%") (return-from bar)))))
fails to compile, with
Too large to be represented as a SINGLE-FLOAT: ...
from
0: ((LABELS SB-BIGNUM::CHECK-EXPONENT) ...)
1: ((LABELS SB-BIGNUM::FLOAT-FROM-BITS) ...)
2: (SB-KERNEL:%SINGLE-FLOAT ...)
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?
(reported by Ariel Badichi on sbcl-devel 2007-01-09)
(handler- case
(coerce n 'single-float)
(simple- type-error ()
(format t "Got here.~%")
(return- from foo)))))
(handler- case
(format t "~E~%" (coerce n 'single-float))
(simple- type-error ()
(format t "Got here.~%")
(return- from bar))))) :CHECK- EXPONENT) ...) :FLOAT- FROM-BITS) ...) %SINGLE- FLOAT ...) %SINGLE- FLOAT-DERIVE- TYPE-AUX ...)
407a: In sbcl-1.0.1 on Linux x86,
(defun foo ()
(loop for n from (expt 2 1024) do
(foo)
causes an infinite loop, where handling the error would be expected.
407b: In sbcl-1.0.1 on Linux x86,
(defun bar ()
(loop for n from (expt 2 1024) do
fails to compile, with
Too large to be represented as a SINGLE-FLOAT: ...
from
0: ((LABELS SB-BIGNUM:
1: ((LABELS SB-BIGNUM:
2: (SB-KERNEL:
3: (SB-C::BOUND-FUNC ...)
4: (SB-C::
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?