[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: Tom Tromey
Subject: Re: Using the GNU GMP Library for Bignums in Emacs
Date: Thu, 05 Jul 2018 15:29:17 -0600
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.1.50 (gnu/linux)

>>>>> "Stefan" == Stefan Monnier <address@hidden> writes:

Stefan> There are several steps to adding GMP support.  Some of those steps
Stefan> might involve non-trivial decisions.  But the first few steps should be
Stefan> straightforward enough:
Stefan> A- add a new "bignum" type
Stefan> B- add new operations on them (this might be enough to start using them 
in Calc)
Stefan> C- add support for bignums to some of the pre-existing functions (e.g. 
Stefan> D- add support for bignums to more of the pre-existing functions
Stefan> E- add support for bignums "everywhere" where numbers are usually 

Stefan> Anything before D/E should be fairly straightforward.
Stefan> I consider "support for read&print" to fall somewhere in D or maybe E.

I've got some of this working.

I've added configury for GMP and added a new bignum type.

I've made some operations work -- comparisons, abs, float.  I haven't
made arith_driver bignum-aware yet, so no "+", "-", etc.  This doesn't
look too hard.

Some part of "format" work but I haven't tried to handle all the cases
discussed in this thread.

A few things need to be discussed.

1. Should the C core change the names of things like NUMBERP to FIXNUMP?
   Similarly should make_number -> make_fixnum?
   I could do this with sed I suppose.  In the meantime I've tweaked the
   necessary spots in a somewhat ugly way.

2. What is (type-of 5)?  Right now 'integer, but arguably perhaps
   'fixnum is correct.  Gerd's branch did this.

3. Should intbig_to_lisp et al be converted to use bignums?
   I'm inclined to say no, for compatibility.

4. Should it be possible to make a "low-valued bignum"?  For testing I
   have a make-bignum function that turns a fixnum into a like-valued
   bignum.  However, maybe this should just not be possible.  (And most
   likely make-bignum should just be deleted before merging any of

I've pushed this to my github but I could push it to a branch on
savannah if that's useful.  I don't know the current branch naming
convention, so I'd need guidance there.


reply via email to

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