The computation ends when newGuess*newGuess is close to N.
Here is a recursive version of this:
Recall that
guess*guess nearly equals N
can be rearranged into
N/(guess*guess) nearly = 1.0
which can be rearranged into
| N / (guess*guess) - 1.0 | < smallValue
where the vertical bars mean "absolute value".
(Review: ) Can smallValue
be really, really small?