A Community Devoted to the Preservation and Practice of Celestial Navigation and Other Methods of Traditional Wayfinding
From: Robin Stuart
Date: 2021 Jul 21, 11:45 -0700
The formula discuused previously here http://fer3.com/arc/m2.aspx/Which-calculator-use-for-arctantan269-Stuart-feb-2017-g38110 does not blow up at the north or south pole.
tan Zn = - sin(LHA) / (cos L tan δ - sin L cos(LHA))
This formula has the advantage that if evaluated with 2 argument arctangent function there in no quadrant abiguity as there is with the one involving cos(Az) that you gave. I will leave it up to you to decide whether the results returned at the poles make sense,