Comment 0 for bug 308940

Revision history for this message
Nikodemus Siivola (nikodemus) wrote :

  (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?