Anybody want to help me with some math? Consider:

Diagram 1
I know angle A, distance D, angle AΔ and distance DΔ. I’m trying to find angle A?. This is what I came up with:

The proposed formula.
At first I thought I was all good, but this doesn’t work for all A and AΔ (which is obvious in hindsight). For instance, this works fine if A is negative:

A working case with negative angles.
But this doesn’t work…

A failing case with large angles.
…essentially because the range of arc tangent is (-90,+90) degrees. Or, put another way, because there is no right triangle with angle A.
Is there a single formula that will work for all A and AΔ without the need for conditionals?
