[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Using the GNU GMP Library for Bignums in Emacs

From: Siraphob (Ben) Phipathananunth
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Sat, 21 Apr 2018 22:40:05 +0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.6.0

Paul Eggert wrote:
> Surely we should just add bignum support to existing functions +, -,
> etc. Wouldn't that suffice for 'calc'? If not, why not? (Of course
> 'calc' would need to be changed to exploit the bignums properly, no
> matter how we add bignums.)

Of course we could to do that. Hopefully there isn't existing
Emacs Lisp code that relies on unsafe arithmetic /anywhere/. If the
functions + - * / operate on bignums (instead of dedicated bignum
functions), would that mean we drop 32/64 bit integers entirely?

Eli Zaretskii wrote:
> The design should IMO be discussed up front, because we want not only
> to be able to use bignums and arbitrary-precision floating-point
> numbers in C, but also in Lisp.

I thought that Eli was talking about how we should interface bignums
to Emacs Lisp; the + - * / operators are defined in C source
code. Bignums would decrease performance in areas where the usual
32/64 bit integers are sufficient, and lead to higher memory usage. It
would make much more sense to have separate math functions for 32/64
bit numbers and for bignums. In doing so, it should be obvious to the
Emacs Lisp programmer when to use what.

Paul Eggert wrote:
> This should be a separate task. Bignums alone are quite a large-enough
> project. I'm not even sure we should do rationals.

Rationals would be a part of Emacs Calc, once we have bignums it
should be trivial to reimplement rationals.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]