Jeroen Demeyer on Mon, 04 Feb 2008 12:30:02 +0100

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

integer n-roots like sqrtint()

Hello list,

I am wondering if there is an analogous function to sqrtint, but for n-th roots? With this I mean to compute floor(sqrtn(x,n)) exactly for integers x and n.
Unfortunately the obvious "floor(sqrtn(x,n))" does not work:

gp> \p100
   realprecision = 105 significant digits (100 digits displayed)
gp> floor(sqrtn(6^3,3))
%33 = 5

Of course I could do "floor(sqrtn(x,n) + 1e-90)" or something but that's not very elegant and doesn't work for very large numbers.