Raymond Toy pushed to branch rtoy-print-using-ryu at cmucl / cmucl Commits: 5bd680bc by Raymond Toy at 2026-05-25T07:42:55-07:00 Use the correct exponent marker for ~E and ~G We were always using d for the ryu printer, but the marker depends on the type of the number and `*read-default-float-format*`. - - - - - 1 changed file: - src/code/format.lisp Changes: ===================================== src/code/format.lisp ===================================== @@ -1893,7 +1893,14 @@ (float-nan-p number))) (prin1 number stream)) (t - (write-string (lisp::format-e number w d e k ovf pad marker atsign) + ;; LISP::FORMAT-E uses a literal #\d as the default exponent + ;; marker when EXPONENTCHAR is NIL, but the CL ~E directive + ;; chooses the marker based on the value's type and + ;; *READ-DEFAULT-FLOAT-FORMAT* (see FORMAT-EXPONENT-MARKER). + ;; Resolve the default here so the same rule applies. + (write-string (lisp::format-e number w d e k ovf pad + (or marker (format-exponent-marker number)) + atsign) stream))) (values)) @@ -1971,7 +1978,9 @@ (prin1 number stream) nil) (t - (write-string (lisp::format-g number w d e (or k 1) ovf pad marker atsign) + (write-string (lisp::format-g number w d e (or k 1) ovf pad + (or marker (format-exponent-marker number)) + atsign) stream))) (values)) View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/5bd680bcf4cee4c2fe91e5ae... -- View it on GitLab: https://gitlab.common-lisp.net/cmucl/cmucl/-/commit/5bd680bcf4cee4c2fe91e5ae... You're receiving this email because of your account on gitlab.common-lisp.net. Manage all notifications: https://gitlab.common-lisp.net/-/profile/notifications | Help: https://gitlab.common-lisp.net/help