Bill Allombert on Mon, 13 Jan 2014 14:17:15 +0100


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

New GP function logint


Dear PARI developers,
As discuted on this list and at the atelier,
I have added a function logint() to GP.

? ?logint
logint(x,b,&z): b being an integer > 1, and x an integer > 0, return the largest integer e so
that b^e <= x. If present, set z to b^e.

In particular, logint(x,2) is identical to the C function expi.

? logint(4,2)
%1 = 2
? logint(100000,3)
%2 = 10

This avoid precision issues in constructs like
ceil(log(a)/log(b))
which can fail if a is too large with respect to the current precision.

Cheers,
Bill.