[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using the GNU GMP Library for Bignums in Emacs
From: |
Ken Raeburn |
Subject: |
Re: Using the GNU GMP Library for Bignums in Emacs |
Date: |
Mon, 7 May 2018 13:24:58 -0400 |
On May 5, 2018, at 23:12, Richard Stallman <address@hidden> wrote:
>
> [[[ To any NSA and FBI agents reading my email: please consider ]]]
> [[[ whether defending the US Constitution against all enemies, ]]]
> [[[ foreign or domestic, requires you to follow Snowden's example. ]]]
>
>>> Another idea: %Nx with a negative number should output its 2's
>>> complement representation in 4N bits.
>
>> That's already taken: A leading “-“ means to left-justify the output if the
>> specified width is wider than required.
>
> We are miscommunicating. I'm talking about what %Nx should do when
> outputting an argument that is negative, as in (format "%16x" -63).
>
> Sorry that wasn't clear.
>
> You could try p/x -63 in GDB to see what I mean.
Oh, I see. Yes, I misunderstood. Apologies for my confusion.
So, in this case, would it truncate the output or use a wider field, if the
value couldn’t “properly” be shown in the specified size?
E.g., -5000 would display in hex as …ffec78; with a format “%2x” should it
return “78” or should it get enough digits to show the minimum number of bits
needed to express the real value, much like formatting with “%2d” would still
give you “-5000” instead of chopping off relevant digits?
Maybe we can supply both bit count and minimum field width in a format string…
“%32!8x” to display the lowest 32 bits in 8 columns but with leading spaces
rather than zeros? Or swap the positions of the numbers. And maybe one could be
optional; “%32!x” could mean either “%32!8x” (eight columns, leading spaces) or
“%32!1x” (minimum one column, i.e., no leading spaces or zeros added).
It would be logical to consider whether the same format extensions would be
useful with %o or %d (or others?) being used to format bignums.
Ken
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/05/01
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/05/02
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/05/03
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/05/03
- Re: Using the GNU GMP Library for Bignums in Emacs, Eli Zaretskii, 2018/05/03
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/05/03
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/05/04
- Re: Using the GNU GMP Library for Bignums in Emacs, Ken Raeburn, 2018/05/05
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/05/05
- Re: Using the GNU GMP Library for Bignums in Emacs,
Ken Raeburn <=
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/05/07
- Re: Using the GNU GMP Library for Bignums in Emacs, Andreas Schwab, 2018/05/07
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/05/03
- Message not available
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/05/03
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/05/03
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/05/04