Aurel Page on Tue, 19 Dec 2023 09:08:47 +0100


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

Re: Finding bitprecision


This is the time to create 1. at your precision, not the time to find the bitprecision.

? my(s=0,p=10^4); localprec(p); for(n=1,10^5,a=1.; s+=p);
time = 74 ms.
? my(s=0,p=10^6); localprec(p); for(n=1,10^5,a=1.; s+=p);
time = 2,718 ms.

Best,
Aurel

On 19/12/2023 07:20, Ilya Zakharevich wrote:
Should not there be O(1) way to find the current localbitprecision()?

   (22:17) gp > localprec(10000);   my(s); for(n=1,100000,  s+=bitprecision(1.));
   time = 78 ms.
   (22:17) gp > localprec(1000000); my(s); for(n=1,100000,  s+=bitprecision(1.));
   time = 2,121 ms.

Thanks,
Ilya