SF [2159499] Full bigfloat precision for Gamma after the second call



Am 15 Oct 2008 um 12:34 hat Raymond Toy geschrieben:

> > (defun fprt18231_ nil  
> >   (let ((a 1823176476672000)
> >         (n 42698670666) 
> >         (d 1000)     
> >         (p (ceiling fpprec 3.3)))    
> >      (do ((prec 10 (* 2 prec)))
> >          ((> prec p))
> >        (setq h n)
> >        (setq n (+ (* n n) (* a d d)))
> >        (setq d (* 2 h d)) )
> >      (fpquotient (intofp n) (intofp d)) ))
> 
> Why divide fpprec by 3.3?  To convert to back to digits?

That was what I thought. But you are right,

(do ((prec 36 (* 2 prec)))
             ((> prec fpprec))

is better. No need for an extra variable and computation.
 
> In that case, why not start with prec = 36 (10 digits) and make the
> condition (> prec fpprec)?
> 
> Also, it occurred to me that you are computing sqrt(a).  Could we not
> use the Lisp routine isqrt to compute sqrt(a*2^(2*n))?  (isqrt computes
> an integer such that when squared it is just less than the argument.)
> Then the answer would be isqrt(a*2^(2*n))/2^n.  Of course, for this to
> be fast, the Lisp implementation needs a fast isqrt.  I think cmucl and
> sbcl have fast isqrt.

Richard suggested iroot. I think, here I will make some tests concerning speed. 
I am using gcl on Windows and I can also check it with clisp on ubuntu. 
I'll let you know. (But not today.)

Thanks to both of you for your suggestions

Volker

> Ray
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima