intfact.spad line 201 [edit on github]
The IntegerRoots package computes square roots and nth roots of integers efficiently.
approxRoot(n, r) returns an approximation x to n^(1/r) such that -1 < x - n^(1/r) < 1
approxSqrt(n) returns an approximation x to sqrt(n) such that -1 < x - sqrt(n) < 1. Returns 0 if n is negative. A variable precision Newton iteration is used. The running time is O( log(n)^2 ).
perfectNthPower?(n, r) returns true if n is an rth power and false otherwise
perfectNthRoot(n) returns [x, r], where n = x^r and r is the largest integer such that n is a perfect rth power
perfectNthRoot(n, r) returns the rth root of n if n is an rth power and returns "failed" otherwise
perfectSqrt(n) returns the square root of n if n is a perfect square and returns "failed" otherwise
perfectSquare?(n) returns true if n is a perfect square and false otherwise