How to improve the bound on Euclidean algorithm by allowing the remainder to be negative ? namely, if $a,b \in \mathbb{Z}$, let $a = bq + r$, where $|r| \leq \frac{|b|}{2}$.
Old version of the Euclidean algorithm is by letting $r_{-1} = a$ and $r_{0} = b$ and doing $r_{i-1} = q_{i+1} \times r_i + r_{i+1}$ for some $i = 1, 2, 3, ...$ inductively until the rmainder $r_{n+1} = 0$. Which the last nonzero remainder $r_n$ is the $gcd(a,b)$.
$\mathbf{My~attempt:}$
My improved Euclidean algorithm is by letting $r_{-1} = a$ and $r_{0} = b$ and doing $r_{i-1} = q_{i+1} \times r_i + x_{i+1} \times r_{i+1}$ where $r_{i+1} \leq \lfloor \frac{r_n}{2} \rfloor$ and each $x$ is either $1$ or $-1$ for some $i = 1, 2, 3, ...$ inductively until the rmainder $r_{n+1} = 0$.
Which the last nonzero remainder $r_n$ is the $gcd(a,b)$.
For example: let a = 788 and b = 25
by using improve Euclidean algorithm:
$788 = 25 \times 32 + (-1)\times 12$
$25 = 12 \times 2 + 1$
$12 = 1 \times 12 + 0$
So, $gcd(a,b) = 1$
by using the old Euclidean algorithm:
$788 = 25 \times 31 + 13$
$25 = 13 \times 1 + 12$
$13 = 12 \times 1 + 1$
$12 = 1 \times 12 + 0$
So, $gcd(a,b) = 1$
$\mathbf{Is~my~attempt~of~improve~the~bound~on~Euclidean~algorithm}$
$\mathbf{by~allowing~the~remainder~to~be~negative~okay~?}$
$\mathbf{Are~there~anything~for~me~to~fix~or~add~to~make~my~attempt~better~?}$