[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Using the GNU GMP Library for Bignums in Emacs
From: |
Paul Eggert |
Subject: |
Re: Using the GNU GMP Library for Bignums in Emacs |
Date: |
Tue, 24 Apr 2018 18:19:29 -0700 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 |
On 04/24/2018 06:05 PM, Richard Stallman wrote:
> In such applications, it's routine to have hexadecimal numbers that are
wider
> than 32- or 64-bit words.
What is the motive for using hexadecimal in a case like that?
It varies. One motivation is a desire to communicate a number via text
more-efficiently than base 10 would provide.
> Even in the standard C library (which lacks bignums), the %x printf format
is
> supposed to be used only with unsigned integers.
I think that's a misleading statement of what it does in C. The rule
is to use it with an unsigned _type_. The type, not the value, is
supposed to be unsigned.
In C, if the type is unsigned then the corresponding value is
nonnegative. That is, in C there is no such thing as a negative value
with an unsigned type. The %x format is supposed to be used only with
unsigned types, i.e., only with nonnegative values.
I contend that we want the same behavior in Emacs Lisp, too.
I certainly wouldn't want the behavior you suggest. Among other things,
Emacs Lisp does not have unsigned types, and I'd rather not introduce
such a concept into the language as it'd be needless complexity and an
unnecessary divergence from other Lisps.
In Emacs, 0xffffffff will be a bignum.
Whether 0xffffffff is a bignum will depend on the platform. On my 64-bit
Emacs, 0xffffffff already is supported as a fixnum, and that wouldn't
change if bignums were introduced to Emacs.
Is it a bignum in those other systems?
It depends on the system, I expect (just as it would in Emacs).
- Re: Using the GNU GMP Library for Bignums in Emacs, (continued)
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/22
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/24
- Re: Using the GNU GMP Library for Bignums in Emacs, Helmut Eller, 2018/04/24
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/24
- Re: Using the GNU GMP Library for Bignums in Emacs,
Paul Eggert <=
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/25
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/25
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/29
- Re: Using the GNU GMP Library for Bignums in Emacs, Michael Welsh Duggan, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Stefan Monnier, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Paul Eggert, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/30
- Re: Using the GNU GMP Library for Bignums in Emacs, Richard Stallman, 2018/04/23
- Re: Using the GNU GMP Library for Bignums in Emacs, Stefan Monnier, 2018/04/22