Re: Since we're talking about number formatting

"Tim Bradshaw (as tfb at tfeb dot org)" <[email protected]> Thu, 30 Apr 2026 08:51:58 +0100
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>

> On 29 Apr 2026, at 12:43, AndrĂ© A. Gomes <[email protected]> wrote:
> 
> (defun (x) (format t "~,2g" x))
> --8<---------------cut here---------------end--------------->8---
> 

I think this may be the closest, but it leaves a lot of whitespace (which I'd omitted from my requirements, as well as saying 2sf when I meant 3) and also prints trailing decimal points.

A deeply ironic thing is that the answer for many purposes is to give up: just use write, and then process the result with LaTeX's siunitx package, which looks at CL's number formatting and laughs quietly to itself.

--tim

_______________________________________________
Lisp Hug - the mailing list for LispWorks users
[email protected]
http://www.lispworks.com/support/lisp-hug.html