help-gnu-emacs
[Top][All Lists]
Advanced

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

Re: bigger integers


From: Miles Bader
Subject: Re: bigger integers
Date: Mon, 06 Sep 2004 09:00:17 +0900

Joe Corneli <jcorneli@math.utexas.edu> writes:
> Suggestions on how to make it work for bigger numbers?

You might want to look into the calc/math package (it's part of emacs in
CVS), which implements its own bignum support.  It doesn't seem to have
all that much in the way of clean programmatic interfaces for external
use, but the functionality is there:

E.g.

   (defun factorial-work (num)
     (if (math-lessp num '(float 1 0))
         '(float 1 0)
       (math-mul num (factorial (math-sub num '(float 1 0))))))

Works if you use its bignum notation:

   (factorial-work '(float 12 0))
   => (float (bigpos 16 790 4) 2)

I'm not sure what you need to require to use these routines; maybe
(require 'calc) would be enough?

I looked for conversion routines, e.g., to/from strings, for the calc
bignum format; they surely exist, as calc must use them for its own I/O,
but I couldn't find them in my brief search (calc's code is
unfortunately a bit hard to follow in many places).

-Miles
-- 
[|nurgle|]  ddt- demonic? so quake will have an evil kinda setting? one that
            will  make every christian in the world foamm at the mouth?
[iddt]      nurg, that's the goal

reply via email to

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