Integer square root (source code)

= Integer square root
{title2=$\lfloor\sqrt n\rfloor$}

= Integer sqrt
{synonym}

For a <nonnegative integer> $n$, its <integer square root> is the unique <nonnegative integer> $r$ satisfying $r^2\le n<(r+1)^2$, equivalently $r=\lfloor\sqrt n\rfloor$. Testing $r^2=n$ decides whether $n$ is a <perfect square> using exact <integer arithmetic>.