Raymond Toy pushed to branch master at cmucl / cmucl
Commits: 059069f8 by Raymond Toy at 2024-03-24T23:16:11+00:00 Fix #287: Clean up make-float-aux
- - - - - ad88cf63 by Raymond Toy at 2024-03-24T23:16:13+00:00 Merge branch 'issue-287-clean-up-make-float-aux' into 'master'
Fix #287: Clean up make-float-aux
Closes #287
See merge request cmucl/cmucl!196 - - - - -
2 changed files:
- src/code/reader.lisp - src/i18n/locale/cmucl.pot
Changes:
===================================== src/code/reader.lisp ===================================== @@ -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,24 +1875,10 @@ 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")))) - result)) + ;; 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" float-format (read-buffer-to-string)))))
===================================== src/i18n/locale/cmucl.pot ===================================== @@ -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 ""
View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/compare/d82f9b92e9be439d4e43978...