Euclid's GCD algorithm which is used to find GCD of two input numbers, say, $c$ and $d$, needs the inputs to be positive integers.
Exercise 12 provides an extension to this algorithm and allows $c$ & $d$ to accept
values of the form $u+v\sqrt{2}$, where $u$ and $v$ are integers.
In this case we can find a $r$ (of the form $u+v\sqrt{2}$) such that
$c=dq+r$ , $q$ is a positive integer.
The algorithm can then continue as usual with $c$<-$d$ and $d$<-$r$ in the next step.
The algorithm will however not terminate if $c=1$ and $d=\sqrt{2}$ because there is no common divisor($q$) here.
However, the algorithm can be made to terminate in this case also if some extension is done to the divisor $q$, as explained here (by the author):
If we extend the concept of divisor so that $u+v\sqrt{2}$ is said to divide $a(u+v\sqrt{2})$ if and only if $a$ has the form $u'+v'\sqrt{2}$ for integers $u'$ and $v'$, there is a way to extend the algorithm so that it always will terminate. If we have $c=u+v\sqrt{2}$ and $d=u'+v'\sqrt{2}$, compute $c/d=c(u'-v'\sqrt{2})/(u'^2-2v'^2)=x+y\sqrt{2}$ where x and y are rational. Now let $q=u''+v''\sqrt{2}$ where $u''$ and $v''$ are the nearest integers to $x$ and $y$; and let $r=c-qd$. If $r=u'''+v'''\sqrt{2}$, it follows that $|u'''^2-2v'''^2|<|u'^2-2v'^2|$, hence the computation will terminate.
I did not understand the last line that
If $r=u'''+v'''\sqrt{2}$, it follows that $|u'''^2-2v'''^2|<|u'^2-2v'^2|$, hence the computation will terminate.
Please explain how $|u'''^2-2v'''^2|<|u'^2-2v'^2|$
and how this proves that
computation will terminate.