math/mp-sqrt.c: Explain the algorithm, and particularly the end condition.
authorMark Wooding <mdw@distorted.org.uk>
Mon, 12 Aug 2019 13:44:35 +0000 (14:44 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Mon, 9 Sep 2019 14:46:09 +0000 (15:46 +0100)
commitd9383a70ff0c0a2f25f8e526d275ac650f82390f
treed762b49a219438a7784b2c8312472209812f58e3
parent0a80c8cefb56e80ccb95277b250dab0c10e99d9d
math/mp-sqrt.c: Explain the algorithm, and particularly the end condition.

The gnomic remark that `Increasing x is pointless when -q < 2 x + 1' was
enough to lead me back on the right lines, but is hardly adequate.  I
ended up wasting quite a lot of time with a whiteboard, because the
`... + 1' makes the termination condition look just enough like `the
fraction comes out zero'.  But no: that's (not quite) a
coincidence.  (Thinking more carefully, it's no surprise that the delta
looks similar to the derivative, but it's definitely the former we're
interested in here, rather than the latter.)
math/mp-sqrt.c