Pprint with-float-traps-masked better
Describe the feature
Cmucl pprints the form
(with-float-traps-masked (:underflow)
(let* ((ratio (/ (* (expt 10 exponent) number)
divisor))
(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. Signal an
;; error. See CLHS 2.3.1.1.
(error _"Underflow"))
result))
as
* (pprint '(with-float-traps-masked (:underflow)
(let* ((ratio (/ (* (expt 10 exponent) number)
divisor))
(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. Signal an
;; error. See CLHS 2.3.1.1.
(error "Underflow"))
result)))
(WITH-FLOAT-TRAPS-MASKED (:UNDERFLOW)
(LET* ((RATIO
(/ (* (EXPT 10 EXPONENT) NUMBER) DIVISOR))
(RESULT (COERCE RATIO FLOAT-FORMAT)))
(WHEN (AND (ZEROP RESULT) (NOT (ZEROP NUMBER)))
(ERROR "Underflow"))
RESULT))
This looks funny.
Is there a prototype?
No prototype, but shouldn't be too hard to make it work by adding a
new pprinter to pprint.lisp. We should do the same formatting for
with-float-traps-enabled
too.