GNU bug report logs -
#32252
[PATCH] %o and %x now format signed numbers
Previous Next
Reported by: Paul Eggert <eggert <at> cs.ucla.edu>
Date: Mon, 23 Jul 2018 19:14:02 UTC
Severity: normal
Tags: patch
Done: Paul Eggert <eggert <at> cs.ucla.edu>
Bug is archived. No further changes may be made.
Full log
View this message in rfc822 format
On 07/23/2018 12:49 PM, Drew Adams wrote:
> 1. I don't see where the doc now mentions variable `binary-as-signed'.
binary-as-signed is intentionally documented only in its doc string. The
intent is that it be like the variable read-integer-overflow-as-float.
That is, although it's present if someone actually needs it, we're
hoping actual use cases are so rare that we can obsolete the variable
soon. This is also why it's not a user option.
> I don't see where the doc mentions what the output is for %o and %x - for a negative number or a positive number.
For %o the Elisp manual says "Replace the specification with the
base-eight representation of an
integer", and there is similar wording for %x and %X. It might be
helpful to nail down negative-integer handling with wording like "Format
a negative integer with a leading @samp{-} followed by the absolute value."
> 3. Why the change in the default behavior?
The primary motivation is that the old behavior can't reasonably be
extended to bignums. Also, it's long been an annoyance that the old
behavior was machine dependent: (format "%x" -1) yields different
answers depending on what machine you're running on. The proposed change
would make this usage portable, and would make it obvious what bignums
should do.
This bug report was last modified 2 years and 322 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.