diff --git a/code/reader.lisp b/code/reader.lisp index 82ae7f07ea056620f115ea7984f079abf86d322f..7d6279cbbdccfd1f84c0c61f28e8571938ed6c70 100644 --- a/code/reader.lisp +++ b/code/reader.lisp @@ -5,7 +5,7 @@ ;;; Carnegie Mellon University, and has been placed in the public domain. ;;; (ext:file-comment - "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/reader.lisp,v 1.56 2005/05/06 20:36:31 rtoy Exp $") + "$Header: /Volumes/share2/src/cmucl/cvs2git/cvsroot/src/code/reader.lisp,v 1.57 2005/10/21 13:11:59 rtoy Exp $") ;;; ;;; ********************************************************************** ;;; @@ -1538,8 +1538,17 @@ the end of the stream." (t (error "Internal error in floating point reader."))))) (defun make-float-aux (number divisor float-format stream) - (handler-case - (coerce (/ number divisor) float-format) + (handler-case + (with-float-traps-masked (:underflow) + (let ((result (coerce (/ number divisor) float-format))) + (when (and (zerop result) (not (zerop number))) + ;; With underflow traps disabled, reading any number + ;; smaller than least-positive-foo-float will return zero. + ;; But we really want to indicate that we can't read it. + ;; So if we converted the number to zero, but the number + ;; wasn't actually zero, throw an error. + (error "Underflow")) + result)) (error () (%reader-error stream "Floating-point number not representable"))))