Corner cases of addition on short Weierstrass elliptic curves
The Group Law on Affine Coordinates

Arithmetical rules are derived from the line intersection and tangent equations. The formulas are;
Let $P=(x_1,x_2)$ and $Q=(x_2,y_2)$ be two point in the elliptic curve.

$P+O=O+P=P$
If $x_1 = x_2 $ and $y_1 = - y_2$ and $Q =(x_2,y_2)=(x_1,−y_1)=−P$ then $P + (-P) = O$
If $Q \neq -P$ then the addition $P+Q = (x_3,y_3)$ and the coordinate can be calculated by;

\begin{align}
x_3 = &amp; \lambda^2 -x_1 - x_2  \mod p\\
y_3 = &amp; \lambda(x_1-x_3) -y_1 \mod p
\end{align}
$$
\lambda =
\begin{cases}
\frac{y_2-y_1}{x_2-x_1},  &amp; \text{if $P \neq Q$} \\[2ex]
\frac{3 x_1^2+a}{2y_1},  &amp; \text{if $P = Q$} \\[2ex]
\end{cases}$$

I have is with doubling of the point $(5,0)$ ... Is x or y equal to 0 even allowed when doing math for short Weierstrass elliptic curves?

When doubling we look at the tangent line. We have two cases;

$y_1 \neq 0$ for $P$, then
$$x_3 = m^2 - 2x_1, \quad y_3 = m(x_1 -x_3) - y_1,\quad \text{ where } m = \dfrac{3x_p^2 + a}{2y_p}$$

$y_1 = 0$ for $P$ then $P + P = [2]P = \mathcal{O}$


$(5,0)$ is the special case that the tangent line is vertical, the 4th case in the top figure. This means that $P+P = \mathcal{O}$ and $P$ has order 2. It also can be seen from the formulas, case 2.

update

This is about the implementation issue that people can forget the checks;

Maybe the implementor instead has &quot;+&quot; check for its inputs being equal. But this is less likely as an implementation strategy: it produces a slower and more complicated implementation. Furthermore, it does not catch all the failure cases. For example, the standard Weierstrass addition formulas fail if Q happens to match -P. This will not be caught by random tests.

and

2007 Bernstein–Lange showed that the Edwards addition law is complete for every complete Edwards curve E. This means that, for every rational point P on E, and for every rational point Q on E, the Edwards addition law for inputs P and Q produces as output exactly P+Q. There are no exceptional cases. The Edwards addition law can be used for complete single-scalar multiplication, complete double-scalar multiplication, etc.

So, one addition law for all!