http://www.jsoftware.com/jwiki/Essays/Repeated%20Squaring
http://www.jsoftware.com/jwiki/Essays/Large%20Exponent%20Real%20Arithmetic



----- Original Message -----
From: neville holmes <[email protected]>
Date: Saturday, July 9, 2011 16:58
Subject: Re: [Jprogramming] Large numbers
To: [email protected]

> I noticed the discussion of the time taken to
> compute exact large numbers by repeated exponentiation
> but I didn't particularly read the later ones.
> 
> However they must have lodged in the back of my mind
> because a way of computing them efficiently came to
> me as I was going to sleep.  It is probably what is
> done already, but anyway here goes.
> 
> Let E be the running exponent, S be the running square,
> and R be the running result.  The loop goes S =. *: S;
> if E is odd R =. R * S; E =. <. E % 2.  The execution
> time would be of the order of log of the starting exponent.
> In other words, use the running squares according to
> the bits in the original exponent.
> 
> Curiously, this reminds me of a method I discussed in
> a paper I once wrote on arithmetic (eprints.utas.edu.au/2003)
> that would allow inexact arithmetic to be carried out
> on very large and very small numbers with overflow or
> underflow a concern.  Any use in J ?

----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm

Reply via email to