Commit ad88cf63 authored by Raymond Toy's avatar Raymond Toy
Browse files

Merge branch 'issue-287-clean-up-make-float-aux' into 'master'

Fix #287: Clean up make-float-aux

Closes #287

See merge request !196
parents d82f9b92 059069f8
Loading
Loading
Loading
Loading
Loading
+5 −19
Original line number Diff line number Diff line
@@ -1867,7 +1867,7 @@ the end of the stream."
            (%reader-error stream _"Number not representable as a ~S: ~S"
			   float-format (read-buffer-to-string)))))))

  ;; Otherwise the number might fit, so we carefully compute the result
  ;; Otherwise the number might fit, so we carefully compute the result.
  (handler-case
      (with-float-traps-masked (:underflow)
	(let* ((ratio (/ (* (expt 10 exponent) number)
@@ -1875,23 +1875,9 @@ the end of the stream."
	       (result (coerce ratio float-format)))
	  (when (and (zerop result) (not (zerop number)))
	    ;; The number we've read is so small that it gets
	    ;; converted to 0.0, but is not actually zero.  In this
	    ;; case, we want to round such small numbers to
	    ;; least-positive-foo-float.  If it's still too small, we
	    ;; want to signal an error saying that we can't really
	    ;; convert it because the exponent is too small.
	    ;; See CLHS 2.3.1.1.
	    (let ((float-limit (ecase float-format
				 ((short-float single-float)
				  least-positive-single-float)
				 (double-float
				  least-positive-double-float)
				 #+double-double
				 (double-double-float
				  ext:least-positive-double-double-float))))
	      (if (>= (* 2 ratio) float-limit)
		  (setf result float-limit)
		  (error _"Underflow"))))
	    ;; converted to 0.0, but is not actually zero.  Signal an
	    ;; error.  See CLHS 2.3.1.1.
            (error _"Underflow"))
          result))
    (error ()
	   (%reader-error stream _"Number not representable as a ~S: ~S"
+0 −4
Original line number Diff line number Diff line
@@ -8731,10 +8731,6 @@ msgstr ""
msgid "Number not representable as a ~S: ~S"
msgstr ""
#: src/code/reader.lisp
msgid "Underflow"
msgstr ""
#: src/code/reader.lisp
msgid "Invalid ratio: ~S/~S"
msgstr ""