Karim Belabas on Fri, 30 Jan 2004 21:23:25 +0100


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

Re: bernfrac() faster than bernreal()


* Bill Allombert [2004-01-30 21:04]:
> It seems that bernfrac() is much faster than bernreal() when
> a high accuracy is required:

Yes, this is rather recent :-)

> parisize = 4000000, primelimit = 500000
> ? \p2000
>    realprecision = 2003 significant digits (2000 digits displayed)
> ? #
>    timer = 1 (on)
> ? bernfrac(1000)*1.;
> time = 10 ms.
> ? bernreal(1000);
> time = 1,990 ms.

bernreal is an initialization function, not a 1-shot routine:

? \p2000
  realprecision = 2003 significant digits (2000 digits displayed)
? bernreal(2000);
time = 10,070 ms.
? bernreal(2000);
time = 0 ms.
? bernreal(1000);
time = 0 ms.

etc. See

  http://pari.math.u-bordeaux.fr/archives/pari-users-0311/msg00009.html

for what _should_ be done. Basically, cache individual floating point
approximations to the best accuracy known so far _and_ exact values when they
can be determined.

The current monolithic cache is very inefficient.

    Karim.
-- 
Karim Belabas                     Tel: (+33) (0)1 69 15 57 48
Dep. de Mathematiques, Bat. 425   Fax: (+33) (0)1 69 15 60 19
Universite Paris-Sud              http://www.math.u-psud.fr/~belabas/ 
F-91405 Orsay (France)            http://pari.math.u-bordeaux.fr/  [PARI/GP]