Bill Allombert on Wed, 29 Nov 2023 23:12:53 +0100 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
Re: log_int_rat |
On Wed, Nov 29, 2023 at 10:41:17PM +0100, Ruud H.G. van Tol wrote: > > On 2023-11-29 22:15, Ruud H.G. van Tol wrote: > > [...] > > I was surprised by this performance difference: > > ? localbitprec(10000); my(L = 1-log(2)/log(3)); [ 1 + floor(n/L) > |n<-[0..10^5] ]; > cpu time = 1,061 ms, real time = 1,064 ms. > > ? localbitprec(10000); my(L = log(2)/log(3/2)); [ 1 + n + floor(n*L) > |n<-[0..10^5] ]; > cpu time = 80 ms, real time = 82 ms. > > What would explain that? Division is slower than multiplication... Cheers, Bill