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

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

Re: Calculator: no exponent, full number ?


From: tomas
Subject: Re: Calculator: no exponent, full number ?
Date: Thu, 6 Jun 2019 19:04:59 +0200
User-agent: Mutt/1.5.21 (2010-09-15)

On Thu, Jun 06, 2019 at 06:50:55PM +0200, Emanuel Berg via help-gnu-emacs wrote:
> Marcin Borkowski wrote:
> 
> >> (defun hypotenuse (c1 c2)
> >>   (sqrt (+ (* c1 c1) (* c2 c2))) )
> >
> > Just for the fun, let me mention that this is
> > not a very good algorithm for computing the
> > Pythagorean sum - it may happen that both the
> > operands and the result lie within the bounds
> > for the given type but this calculation blows
> > up because of large squares overflowing.
> 
> Well, first let it be known that Marcin is
> a professional mathematician, famous for his
> remarkable calculations. That said, the above
> comment is on the computer side of things,
> right? In the math world, what would happen is
> just a very large triangle, again - right?
> 
> Assuming integers, how large can they be in
> Emacs Lisp? Eval us:
> 
> most-positive-fixnum ;  536870911
> "Typical values are 2**29 − 1 on 32-bit and
> 2**61 − 1 on 64-bit platforms." [1]

[...]

Newer Emacsen support bignums:

(expt 71 71) => 
275006373483461607657434076627252658495183350017755660813753981774508905998081919405140568848353397233796618192645698819765129996471

That said, calc itself supports bignums since
long.

Cheers
-- t

Attachment: signature.asc
Description: Digital signature


reply via email to

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