Re: Peculiar number formatting?

"David McClain (as dbm at refined-audiometrics dot com)" <[email protected]> Tue, 19 May 2026 15:09:34 -0700
Newsgroups gmane.lisp.lispworks.general
Message-ID <[email protected]>

> On May 19, 2026, at 05:16, Pascal Bourguignon <[email protected]> wrote:
> 
> But the truth of hexadecimal, octal and binary formatting, 
> is that you don’t use them for negative numbers. When you 
> have negative integers, which is Common Lisp have infinite 
> number of digits (1s) before the meaningful digits, what you
>  do to format them is that you truncate them to the word size:
> 


Heh! Yes you are correct, until you overflow (in Lisp) the 24-bit register size. But you still need a way to show what is happening.

That’s when I resort to printing the prefix #\- sign and a bunch of hex digits from the absolute value.

Furthermore, to ease the eyestrain I insert #\_ between digit groups. A 24-but hex number is shown as xx_xxxx while a 48-bit number is shown as a concatenation of two 24-bit numbers: xx_xxxx_xx_xxxx.