Raymond Toy pushed to branch issue-287-clean-up-make-float-aux at cmucl / cmucl
Commits:
-
9d01b5ca
by Raymond Toy at 2024-03-23T12:38:44-07:00
2 changed files:
Changes:
... | ... | @@ -1868,17 +1868,20 @@ the end of the stream." |
1868 | 1868 | float-format (read-buffer-to-string)))))))
|
1869 | 1869 | |
1870 | 1870 | ;; Otherwise the number might fit, so we carefully compute the result.
|
1871 | - (with-float-traps-masked (:underflow)
|
|
1872 | - (let* ((ratio (/ (* (expt 10 exponent) number)
|
|
1873 | - divisor))
|
|
1874 | - (result (coerce ratio float-format)))
|
|
1875 | - (when (and (zerop result) (not (zerop number)))
|
|
1876 | - ;; The number we've read is so small that it gets
|
|
1877 | - ;; converted to 0.0, but is not actually zero. Signal an
|
|
1878 | - ;; error. See CLHS 2.3.1.1.
|
|
1879 | - (%reader-error stream _"Number not representable as a ~S: ~S"
|
|
1880 | - float-format (read-buffer-to-string)))
|
|
1881 | - result)))
|
|
1871 | + (handler-case
|
|
1872 | + (with-float-traps-masked (:underflow)
|
|
1873 | + (let* ((ratio (/ (* (expt 10 exponent) number)
|
|
1874 | + divisor))
|
|
1875 | + (result (coerce ratio float-format)))
|
|
1876 | + (when (and (zerop result) (not (zerop number)))
|
|
1877 | + ;; The number we've read is so small that it gets
|
|
1878 | + ;; converted to 0.0, but is not actually zero. Signal an
|
|
1879 | + ;; error. See CLHS 2.3.1.1.
|
|
1880 | + (error "Underflow"))
|
|
1881 | + result))
|
|
1882 | + (error ()
|
|
1883 | + (%reader-error stream _"Number not representable as a ~S: ~S"
|
|
1884 | + float-format (read-buffer-to-string)))))
|
|
1882 | 1885 | |
1883 | 1886 | |
1884 | 1887 | (defun make-ratio (stream)
|
... | ... | @@ -8731,10 +8731,6 @@ msgstr "" |
8731 | 8731 | msgid "Number not representable as a ~S: ~S"
|
8732 | 8732 | msgstr ""
|
8733 | 8733 | |
8734 | -#: src/code/reader.lisp
|
|
8735 | -msgid "Underflow"
|
|
8736 | -msgstr ""
|
|
8737 | - |
|
8738 | 8734 | #: src/code/reader.lisp
|
8739 | 8735 | msgid "Invalid ratio: ~S/~S"
|
8740 | 8736 | msgstr ""
|