Bearing on a great circle

Percentage Accurate: 78.5% → 99.7%
Time: 34.7s
Alternatives: 34
Speedup: 1.0×

Specification

?
\[\begin{array}{l} \\ \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (atan2
  (* (sin (- lambda1 lambda2)) (cos phi2))
  (-
   (* (cos phi1) (sin phi2))
   (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2):
	return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2)
	return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2)))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 34 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 78.5% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (atan2
  (* (sin (- lambda1 lambda2)) (cos phi2))
  (-
   (* (cos phi1) (sin phi2))
   (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return Math.atan2((Math.sin((lambda1 - lambda2)) * Math.cos(phi2)), ((Math.cos(phi1) * Math.sin(phi2)) - ((Math.sin(phi1) * Math.cos(phi2)) * Math.cos((lambda1 - lambda2)))));
}
def code(lambda1, lambda2, phi1, phi2):
	return math.atan2((math.sin((lambda1 - lambda2)) * math.cos(phi2)), ((math.cos(phi1) * math.sin(phi2)) - ((math.sin(phi1) * math.cos(phi2)) * math.cos((lambda1 - lambda2)))))
function code(lambda1, lambda2, phi1, phi2)
	return atan(Float64(sin(Float64(lambda1 - lambda2)) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(Float64(sin(phi1) * cos(phi2)) * cos(Float64(lambda1 - lambda2)))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = atan2((sin((lambda1 - lambda2)) * cos(phi2)), ((cos(phi1) * sin(phi2)) - ((sin(phi1) * cos(phi2)) * cos((lambda1 - lambda2)))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}
\end{array}

Alternative 1: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (atan2
  (*
   (fma (- 0.0 (sin lambda2)) (cos lambda1) (* (sin lambda1) (cos lambda2)))
   (cos phi2))
  (-
   (* (cos phi1) (sin phi2))
   (*
    (cos phi2)
    (*
     (sin phi1)
     (fma (sin lambda2) (sin lambda1) (* (cos lambda1) (cos lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return atan2((fma((0.0 - sin(lambda2)), cos(lambda1), (sin(lambda1) * cos(lambda2))) * cos(phi2)), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * fma(sin(lambda2), sin(lambda1), (cos(lambda1) * cos(lambda2)))))));
}
function code(lambda1, lambda2, phi1, phi2)
	return atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), Float64(sin(lambda1) * cos(lambda2))) * cos(phi2)), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda1) * cos(lambda2)))))))
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)}
\end{array}
Derivation
  1. Initial program 80.2%

    \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    3. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
    12. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    14. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    17. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    18. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
    19. --lowering--.f6480.2%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  3. Simplified80.2%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. sin-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    4. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f6490.9%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  6. Applied egg-rr90.9%

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
  7. Step-by-step derivation
    1. cos-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
    4. fma-defineN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    10. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    11. cos-lowering-cos.f6499.7%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.7%

    \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
  9. Step-by-step derivation
    1. sub-negN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    4. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    5. fma-defineN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    6. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    7. neg-sub0N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    9. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    10. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    11. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    12. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    13. cos-lowering-cos.f6499.7%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
  10. Applied egg-rr99.7%

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
  11. Final simplification99.7%

    \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)} \]
  12. Add Preprocessing

Alternative 2: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \sin \lambda_2 \cdot \left(0 - \cos \lambda_1\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (atan2
  (*
   (cos phi2)
   (fma (sin lambda1) (cos lambda2) (* (sin lambda2) (- 0.0 (cos lambda1)))))
  (-
   (* (cos phi1) (sin phi2))
   (*
    (cos phi2)
    (*
     (sin phi1)
     (fma (sin lambda2) (sin lambda1) (* (cos lambda1) (cos lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return atan2((cos(phi2) * fma(sin(lambda1), cos(lambda2), (sin(lambda2) * (0.0 - cos(lambda1))))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * fma(sin(lambda2), sin(lambda1), (cos(lambda1) * cos(lambda2)))))));
}
function code(lambda1, lambda2, phi1, phi2)
	return atan(Float64(cos(phi2) * fma(sin(lambda1), cos(lambda2), Float64(sin(lambda2) * Float64(0.0 - cos(lambda1))))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda1) * cos(lambda2)))))))
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda2], $MachinePrecision] * N[(0.0 - N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \sin \lambda_2 \cdot \left(0 - \cos \lambda_1\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)}
\end{array}
Derivation
  1. Initial program 80.2%

    \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    3. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
    12. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    14. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    17. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    18. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
    19. --lowering--.f6480.2%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  3. Simplified80.2%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. sin-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    4. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f6490.9%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  6. Applied egg-rr90.9%

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
  7. Step-by-step derivation
    1. cos-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
    4. fma-defineN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    10. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    11. cos-lowering-cos.f6499.7%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.7%

    \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
  9. Step-by-step derivation
    1. fmm-defN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    2. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\sin \lambda_1, \cos \lambda_2, \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    3. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2, \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    4. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right), \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    5. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right), \left(\cos \lambda_1 \cdot \left(\mathsf{neg}\left(\sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right), \mathsf{*.f64}\left(\cos \lambda_1, \left(\mathsf{neg}\left(\sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \left(\mathsf{neg}\left(\sin \lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. neg-sub0N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \left(0 - \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    9. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{\_.f64}\left(0, \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    10. sin-lowering-sin.f6499.7%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
  10. Applied egg-rr99.7%

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \cos \lambda_1 \cdot \left(0 - \sin \lambda_2\right)\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
  11. Final simplification99.7%

    \[\leadsto \tan^{-1}_* \frac{\cos \phi_2 \cdot \mathsf{fma}\left(\sin \lambda_1, \cos \lambda_2, \sin \lambda_2 \cdot \left(0 - \cos \lambda_1\right)\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)} \]
  12. Add Preprocessing

Alternative 3: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (atan2
  (*
   (cos phi2)
   (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
  (-
   (* (cos phi1) (sin phi2))
   (*
    (cos phi2)
    (*
     (sin phi1)
     (fma (sin lambda2) (sin lambda1) (* (cos lambda1) (cos lambda2))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * fma(sin(lambda2), sin(lambda1), (cos(lambda1) * cos(lambda2)))))));
}
function code(lambda1, lambda2, phi1, phi2)
	return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * fma(sin(lambda2), sin(lambda1), Float64(cos(lambda1) * cos(lambda2)))))))
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)}
\end{array}
Derivation
  1. Initial program 80.2%

    \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    3. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
    12. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    14. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    17. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    18. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
    19. --lowering--.f6480.2%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  3. Simplified80.2%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. sin-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    4. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f6490.9%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  6. Applied egg-rr90.9%

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
  7. Step-by-step derivation
    1. cos-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
    3. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
    4. fma-defineN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    9. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    10. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
    11. cos-lowering-cos.f6499.7%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.7%

    \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
  9. Final simplification99.7%

    \[\leadsto \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)} \]
  10. Add Preprocessing

Alternative 4: 99.7% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (atan2
  (*
   (cos phi2)
   (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
  (-
   (* (cos phi1) (sin phi2))
   (*
    (cos phi2)
    (*
     (sin phi1)
     (fma (cos lambda2) (cos lambda1) (* (sin lambda2) (sin lambda1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * fma(cos(lambda2), cos(lambda1), (sin(lambda2) * sin(lambda1)))))));
}
function code(lambda1, lambda2, phi1, phi2)
	return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * fma(cos(lambda2), cos(lambda1), Float64(sin(lambda2) * sin(lambda1)))))))
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \sin \lambda_2 \cdot \sin \lambda_1\right)\right)}
\end{array}
Derivation
  1. Initial program 80.2%

    \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    3. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
    12. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    14. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    17. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    18. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
    19. --lowering--.f6480.2%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  3. Simplified80.2%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. sin-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    4. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f6490.9%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  6. Applied egg-rr90.9%

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
  7. Step-by-step derivation
    1. cos-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
    2. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1 + \color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
    3. fma-defineN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\cos \lambda_2, \color{blue}{\cos \lambda_1}, \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
    4. fma-lowering-fma.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\cos \lambda_2, \color{blue}{\cos \lambda_1}, \left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \color{blue}{\lambda_1}, \left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
    9. sin-lowering-sin.f6499.7%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.7%

    \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \sin \lambda_2\right)}\right)} \]
  9. Final simplification99.7%

    \[\leadsto \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \]
  10. Add Preprocessing

Alternative 5: 99.7% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (atan2
  (*
   (cos phi2)
   (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
  (-
   (* (cos phi1) (sin phi2))
   (*
    (cos phi2)
    (*
     (sin phi1)
     (+ (* (cos lambda1) (cos lambda2)) (* (sin lambda2) (sin lambda1))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * ((cos(lambda1) * cos(lambda2)) + (sin(lambda2) * sin(lambda1)))))));
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    code = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * ((cos(lambda1) * cos(lambda2)) + (sin(lambda2) * sin(lambda1)))))))
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	return Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.sin(lambda2) * Math.cos(lambda1)))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.cos(phi2) * (Math.sin(phi1) * ((Math.cos(lambda1) * Math.cos(lambda2)) + (Math.sin(lambda2) * Math.sin(lambda1)))))));
}
def code(lambda1, lambda2, phi1, phi2):
	return math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.sin(lambda2) * math.cos(lambda1)))), ((math.cos(phi1) * math.sin(phi2)) - (math.cos(phi2) * (math.sin(phi1) * ((math.cos(lambda1) * math.cos(lambda2)) + (math.sin(lambda2) * math.sin(lambda1)))))))
function code(lambda1, lambda2, phi1, phi2)
	return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * Float64(Float64(cos(lambda1) * cos(lambda2)) + Float64(sin(lambda2) * sin(lambda1)))))))
end
function tmp = code(lambda1, lambda2, phi1, phi2)
	tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * ((cos(lambda1) * cos(lambda2)) + (sin(lambda2) * sin(lambda1)))))));
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)\right)}
\end{array}
Derivation
  1. Initial program 80.2%

    \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    3. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
    12. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    14. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    17. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    18. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
    19. --lowering--.f6480.2%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  3. Simplified80.2%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. sin-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    4. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f6490.9%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  6. Applied egg-rr90.9%

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
  7. Step-by-step derivation
    1. cos-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
    2. +-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
    3. +-lowering-+.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\sin \lambda_1 \cdot \sin \lambda_2\right), \color{blue}{\left(\cos \lambda_1 \cdot \cos \lambda_2\right)}\right)\right)\right)\right)\right) \]
    4. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \sin \lambda_2\right), \left(\color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \sin \lambda_2\right), \left(\cos \color{blue}{\lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_2 \cdot \color{blue}{\cos \lambda_1}\right)\right)\right)\right)\right)\right) \]
    8. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_2, \color{blue}{\cos \lambda_1}\right)\right)\right)\right)\right)\right) \]
    9. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \color{blue}{\lambda_1}\right)\right)\right)\right)\right)\right) \]
    10. cos-lowering-cos.f6499.7%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
  8. Applied egg-rr99.7%

    \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
  9. Final simplification99.7%

    \[\leadsto \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \]
  10. Add Preprocessing

Alternative 6: 94.4% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \sin \lambda_1 \cdot \cos \lambda_2\\ t_2 := \cos \phi_2 \cdot \left(t\_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)\\ t_3 := \cos \phi_1 \cdot \sin \phi_2\\ \mathbf{if}\;\phi_2 \leq -0.15:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot t\_0, t\_3\right)}\\ \mathbf{elif}\;\phi_2 \leq 2.1:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_3 + \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)\right) \cdot \left(-1 - -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, t\_1\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{t\_3 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_0\right)}}}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2)))
        (t_1 (* (sin lambda1) (cos lambda2)))
        (t_2 (* (cos phi2) (- t_1 (* (sin lambda2) (cos lambda1)))))
        (t_3 (* (cos phi1) (sin phi2))))
   (if (<= phi2 -0.15)
     (atan2 t_2 (fma (- 0.0 (sin phi1)) (* (cos phi2) t_0) t_3))
     (if (<= phi2 2.1)
       (atan2
        t_2
        (+
         t_3
         (*
          (*
           (sin phi1)
           (+ (* (cos lambda1) (cos lambda2)) (* (sin lambda2) (sin lambda1))))
          (- -1.0 (* -0.5 (* phi2 phi2))))))
       (atan2
        (* (fma (- 0.0 (sin lambda2)) (cos lambda1) t_1) (cos phi2))
        (/ 1.0 (/ 1.0 (- t_3 (* (cos phi2) (* (sin phi1) t_0))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double t_1 = sin(lambda1) * cos(lambda2);
	double t_2 = cos(phi2) * (t_1 - (sin(lambda2) * cos(lambda1)));
	double t_3 = cos(phi1) * sin(phi2);
	double tmp;
	if (phi2 <= -0.15) {
		tmp = atan2(t_2, fma((0.0 - sin(phi1)), (cos(phi2) * t_0), t_3));
	} else if (phi2 <= 2.1) {
		tmp = atan2(t_2, (t_3 + ((sin(phi1) * ((cos(lambda1) * cos(lambda2)) + (sin(lambda2) * sin(lambda1)))) * (-1.0 - (-0.5 * (phi2 * phi2))))));
	} else {
		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), t_1) * cos(phi2)), (1.0 / (1.0 / (t_3 - (cos(phi2) * (sin(phi1) * t_0))))));
	}
	return tmp;
}
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	t_1 = Float64(sin(lambda1) * cos(lambda2))
	t_2 = Float64(cos(phi2) * Float64(t_1 - Float64(sin(lambda2) * cos(lambda1))))
	t_3 = Float64(cos(phi1) * sin(phi2))
	tmp = 0.0
	if (phi2 <= -0.15)
		tmp = atan(t_2, fma(Float64(0.0 - sin(phi1)), Float64(cos(phi2) * t_0), t_3));
	elseif (phi2 <= 2.1)
		tmp = atan(t_2, Float64(t_3 + Float64(Float64(sin(phi1) * Float64(Float64(cos(lambda1) * cos(lambda2)) + Float64(sin(lambda2) * sin(lambda1)))) * Float64(-1.0 - Float64(-0.5 * Float64(phi2 * phi2))))));
	else
		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), t_1) * cos(phi2)), Float64(1.0 / Float64(1.0 / Float64(t_3 - Float64(cos(phi2) * Float64(sin(phi1) * t_0))))));
	end
	return tmp
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$1 - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -0.15], N[ArcTan[t$95$2 / N[(N[(0.0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 2.1], N[ArcTan[t$95$2 / N[(t$95$3 + N[(N[(N[Sin[phi1], $MachinePrecision] * N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(-1.0 - N[(-0.5 * N[(phi2 * phi2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + t$95$1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(1.0 / N[(t$95$3 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_2 := \cos \phi_2 \cdot \left(t\_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)\\
t_3 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\phi_2 \leq -0.15:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot t\_0, t\_3\right)}\\

\mathbf{elif}\;\phi_2 \leq 2.1:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_3 + \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)\right) \cdot \left(-1 - -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, t\_1\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{t\_3 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_0\right)}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi2 < -0.149999999999999994

    1. Initial program 76.0%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6476.0%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified76.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6491.1%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr91.1%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right) \]
      3. sub-negN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \color{blue}{\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right)}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + \color{blue}{\cos \phi_1 \cdot \sin \phi_2}\right)\right) \]
      7. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      10. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) + \color{blue}{\cos \phi_1} \cdot \sin \phi_2\right)\right) \]
    8. Applied egg-rr91.1%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}} \]

    if -0.149999999999999994 < phi2 < 2.10000000000000009

    1. Initial program 82.3%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6482.3%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified82.3%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6490.2%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr90.2%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. cos-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
      4. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      11. cos-lowering-cos.f6499.8%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.8%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
    9. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \color{blue}{\left(\frac{-1}{2} \cdot \left({\phi_2}^{2} \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right) + \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\right)\right) \]
    10. Step-by-step derivation
      1. associate-*r*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\frac{-1}{2} \cdot {\phi_2}^{2}\right) \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right) + \color{blue}{\sin \phi_1} \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right) \]
      2. distribute-lft1-inN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right) \cdot \color{blue}{\left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\left(\frac{-1}{2} \cdot {\phi_2}^{2} + 1\right), \color{blue}{\left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\right)\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\left(\frac{-1}{2} \cdot {\phi_2}^{2}\right), 1\right), \left(\color{blue}{\sin \phi_1} \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left({\phi_2}^{2}\right)\right), 1\right), \left(\sin \color{blue}{\phi_1} \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      6. unpow2N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \left(\phi_2 \cdot \phi_2\right)\right), 1\right), \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)}\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\color{blue}{\cos \lambda_1 \cdot \cos \lambda_2} + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      10. +-lowering-+.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\cos \lambda_1 \cdot \cos \lambda_2\right), \color{blue}{\left(\sin \lambda_1 \cdot \sin \lambda_2\right)}\right)\right)\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\cos \lambda_2 \cdot \cos \lambda_1\right), \left(\color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
      12. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right), \left(\color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
      13. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right), \left(\sin \color{blue}{\lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
      15. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\phi_2, \phi_2\right)\right), 1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\sin \lambda_1, \color{blue}{\sin \lambda_2}\right)\right)\right)\right)\right)\right) \]
    11. Simplified99.1%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\left(-0.5 \cdot \left(\phi_2 \cdot \phi_2\right) + 1\right) \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_2 \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}} \]

    if 2.10000000000000009 < phi2

    1. Initial program 80.6%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6480.6%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified80.6%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6491.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr91.7%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. cos-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
      4. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      11. cos-lowering-cos.f6499.6%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.6%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      4. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      5. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      6. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      7. neg-sub0N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      12. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      13. cos-lowering-cos.f6499.6%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    10. Applied egg-rr99.6%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
    11. Applied egg-rr91.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\frac{1}{\frac{1}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -0.15:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}\\ \mathbf{elif}\;\phi_2 \leq 2.1:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 + \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)\right) \cdot \left(-1 - -0.5 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 93.8% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \sin \lambda_1 \cdot \cos \lambda_2\\ t_2 := \cos \phi_2 \cdot \left(t\_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)\\ t_3 := \cos \phi_1 \cdot \sin \phi_2\\ \mathbf{if}\;\phi_2 \leq -0.031:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot t\_0, t\_3\right)}\\ \mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_3 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, t\_1\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{t\_3 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_0\right)}}}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2)))
        (t_1 (* (sin lambda1) (cos lambda2)))
        (t_2 (* (cos phi2) (- t_1 (* (sin lambda2) (cos lambda1)))))
        (t_3 (* (cos phi1) (sin phi2))))
   (if (<= phi2 -0.031)
     (atan2 t_2 (fma (- 0.0 (sin phi1)) (* (cos phi2) t_0) t_3))
     (if (<= phi2 2.8e-55)
       (atan2
        t_2
        (-
         t_3
         (*
          (sin phi1)
          (+
           (* (cos lambda1) (cos lambda2))
           (* (sin lambda2) (sin lambda1))))))
       (atan2
        (* (fma (- 0.0 (sin lambda2)) (cos lambda1) t_1) (cos phi2))
        (/ 1.0 (/ 1.0 (- t_3 (* (cos phi2) (* (sin phi1) t_0))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double t_1 = sin(lambda1) * cos(lambda2);
	double t_2 = cos(phi2) * (t_1 - (sin(lambda2) * cos(lambda1)));
	double t_3 = cos(phi1) * sin(phi2);
	double tmp;
	if (phi2 <= -0.031) {
		tmp = atan2(t_2, fma((0.0 - sin(phi1)), (cos(phi2) * t_0), t_3));
	} else if (phi2 <= 2.8e-55) {
		tmp = atan2(t_2, (t_3 - (sin(phi1) * ((cos(lambda1) * cos(lambda2)) + (sin(lambda2) * sin(lambda1))))));
	} else {
		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), t_1) * cos(phi2)), (1.0 / (1.0 / (t_3 - (cos(phi2) * (sin(phi1) * t_0))))));
	}
	return tmp;
}
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	t_1 = Float64(sin(lambda1) * cos(lambda2))
	t_2 = Float64(cos(phi2) * Float64(t_1 - Float64(sin(lambda2) * cos(lambda1))))
	t_3 = Float64(cos(phi1) * sin(phi2))
	tmp = 0.0
	if (phi2 <= -0.031)
		tmp = atan(t_2, fma(Float64(0.0 - sin(phi1)), Float64(cos(phi2) * t_0), t_3));
	elseif (phi2 <= 2.8e-55)
		tmp = atan(t_2, Float64(t_3 - Float64(sin(phi1) * Float64(Float64(cos(lambda1) * cos(lambda2)) + Float64(sin(lambda2) * sin(lambda1))))));
	else
		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), t_1) * cos(phi2)), Float64(1.0 / Float64(1.0 / Float64(t_3 - Float64(cos(phi2) * Float64(sin(phi1) * t_0))))));
	end
	return tmp
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$1 - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -0.031], N[ArcTan[t$95$2 / N[(N[(0.0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 2.8e-55], N[ArcTan[t$95$2 / N[(t$95$3 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + t$95$1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(1.0 / N[(t$95$3 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_2 := \cos \phi_2 \cdot \left(t\_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)\\
t_3 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\phi_2 \leq -0.031:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot t\_0, t\_3\right)}\\

\mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_3 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, t\_1\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{t\_3 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_0\right)}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi2 < -0.031

    1. Initial program 76.0%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6476.0%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified76.0%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6491.1%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr91.1%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right) \]
      3. sub-negN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \color{blue}{\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right)}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + \color{blue}{\cos \phi_1 \cdot \sin \phi_2}\right)\right) \]
      7. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      10. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) + \color{blue}{\cos \phi_1} \cdot \sin \phi_2\right)\right) \]
    8. Applied egg-rr91.1%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}} \]

    if -0.031 < phi2 < 2.79999999999999984e-55

    1. Initial program 81.5%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6481.5%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified81.5%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6490.0%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr90.0%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. cos-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
      4. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      11. cos-lowering-cos.f6499.8%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.8%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
    9. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \color{blue}{\left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\right)\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)}\right)\right)\right) \]
      2. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\color{blue}{\cos \lambda_1 \cdot \cos \lambda_2} + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right) \]
      3. +-lowering-+.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\cos \lambda_1 \cdot \cos \lambda_2\right), \color{blue}{\left(\sin \lambda_1 \cdot \sin \lambda_2\right)}\right)\right)\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\cos \lambda_2 \cdot \cos \lambda_1\right), \left(\color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      5. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right), \left(\color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right), \left(\sin \color{blue}{\lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\sin \lambda_1, \color{blue}{\sin \lambda_2}\right)\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \sin \color{blue}{\lambda_2}\right)\right)\right)\right)\right) \]
      10. sin-lowering-sin.f6499.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
    11. Simplified99.7%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\sin \phi_1 \cdot \left(\cos \lambda_2 \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \sin \lambda_2\right)}} \]

    if 2.79999999999999984e-55 < phi2

    1. Initial program 81.7%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6481.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified81.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6491.8%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr91.8%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. cos-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
      4. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      11. cos-lowering-cos.f6499.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.7%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      4. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      5. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      6. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      7. neg-sub0N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      12. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      13. cos-lowering-cos.f6499.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    10. Applied egg-rr99.7%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
    11. Applied egg-rr91.9%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\frac{1}{\frac{1}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -0.031:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}\\ \mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 93.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_1 := \sin \lambda_1 \cdot \cos \lambda_2\\ t_2 := \cos \phi_2 \cdot \left(t\_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)\\ t_3 := \cos \phi_1 \cdot \sin \phi_2\\ \mathbf{if}\;\phi_2 \leq -1.28 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot t\_0, t\_3\right)}\\ \mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, t\_1\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{t\_3 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_0\right)}}}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (- lambda1 lambda2)))
        (t_1 (* (sin lambda1) (cos lambda2)))
        (t_2 (* (cos phi2) (- t_1 (* (sin lambda2) (cos lambda1)))))
        (t_3 (* (cos phi1) (sin phi2))))
   (if (<= phi2 -1.28e-5)
     (atan2 t_2 (fma (- 0.0 (sin phi1)) (* (cos phi2) t_0) t_3))
     (if (<= phi2 2.8e-55)
       (atan2
        t_2
        (-
         (* phi2 (cos phi1))
         (*
          (sin phi1)
          (+
           (* (cos lambda1) (cos lambda2))
           (* (sin lambda2) (sin lambda1))))))
       (atan2
        (* (fma (- 0.0 (sin lambda2)) (cos lambda1) t_1) (cos phi2))
        (/ 1.0 (/ 1.0 (- t_3 (* (cos phi2) (* (sin phi1) t_0))))))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((lambda1 - lambda2));
	double t_1 = sin(lambda1) * cos(lambda2);
	double t_2 = cos(phi2) * (t_1 - (sin(lambda2) * cos(lambda1)));
	double t_3 = cos(phi1) * sin(phi2);
	double tmp;
	if (phi2 <= -1.28e-5) {
		tmp = atan2(t_2, fma((0.0 - sin(phi1)), (cos(phi2) * t_0), t_3));
	} else if (phi2 <= 2.8e-55) {
		tmp = atan2(t_2, ((phi2 * cos(phi1)) - (sin(phi1) * ((cos(lambda1) * cos(lambda2)) + (sin(lambda2) * sin(lambda1))))));
	} else {
		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), t_1) * cos(phi2)), (1.0 / (1.0 / (t_3 - (cos(phi2) * (sin(phi1) * t_0))))));
	}
	return tmp;
}
function code(lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(lambda1 - lambda2))
	t_1 = Float64(sin(lambda1) * cos(lambda2))
	t_2 = Float64(cos(phi2) * Float64(t_1 - Float64(sin(lambda2) * cos(lambda1))))
	t_3 = Float64(cos(phi1) * sin(phi2))
	tmp = 0.0
	if (phi2 <= -1.28e-5)
		tmp = atan(t_2, fma(Float64(0.0 - sin(phi1)), Float64(cos(phi2) * t_0), t_3));
	elseif (phi2 <= 2.8e-55)
		tmp = atan(t_2, Float64(Float64(phi2 * cos(phi1)) - Float64(sin(phi1) * Float64(Float64(cos(lambda1) * cos(lambda2)) + Float64(sin(lambda2) * sin(lambda1))))));
	else
		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), t_1) * cos(phi2)), Float64(1.0 / Float64(1.0 / Float64(t_3 - Float64(cos(phi2) * Float64(sin(phi1) * t_0))))));
	end
	return tmp
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$1 - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -1.28e-5], N[ArcTan[t$95$2 / N[(N[(0.0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] + t$95$3), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 2.8e-55], N[ArcTan[t$95$2 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + t$95$1), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(1.0 / N[(1.0 / N[(t$95$3 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(\lambda_1 - \lambda_2\right)\\
t_1 := \sin \lambda_1 \cdot \cos \lambda_2\\
t_2 := \cos \phi_2 \cdot \left(t\_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)\\
t_3 := \cos \phi_1 \cdot \sin \phi_2\\
\mathbf{if}\;\phi_2 \leq -1.28 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot t\_0, t\_3\right)}\\

\mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_2}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, t\_1\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{t\_3 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_0\right)}}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi2 < -1.2799999999999999e-5

    1. Initial program 76.4%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6476.4%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified76.4%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6491.2%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr91.2%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right) \]
      3. sub-negN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \color{blue}{\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right)}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + \color{blue}{\cos \phi_1 \cdot \sin \phi_2}\right)\right) \]
      7. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      10. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) + \color{blue}{\cos \phi_1} \cdot \sin \phi_2\right)\right) \]
    8. Applied egg-rr91.2%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}} \]

    if -1.2799999999999999e-5 < phi2 < 2.79999999999999984e-55

    1. Initial program 81.4%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6481.4%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified81.4%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6489.9%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr89.9%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. cos-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
      4. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      11. cos-lowering-cos.f6499.8%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.8%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
    9. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\right) \]
    10. Step-by-step derivation
      1. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\phi_2 \cdot \cos \phi_1\right), \color{blue}{\left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \cos \phi_1\right), \left(\color{blue}{\sin \phi_1} \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)}\right)\right)\right) \]
      5. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\color{blue}{\cos \lambda_1 \cdot \cos \lambda_2} + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\cos \lambda_1 \cdot \cos \lambda_2\right), \color{blue}{\left(\sin \lambda_1 \cdot \sin \lambda_2\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\cos \lambda_2 \cdot \cos \lambda_1\right), \left(\color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right), \left(\color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right), \left(\sin \color{blue}{\lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\sin \lambda_1, \color{blue}{\sin \lambda_2}\right)\right)\right)\right)\right) \]
      12. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \sin \color{blue}{\lambda_2}\right)\right)\right)\right)\right) \]
      13. sin-lowering-sin.f6499.6%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
    11. Simplified99.6%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_2 \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \sin \lambda_2\right)}} \]

    if 2.79999999999999984e-55 < phi2

    1. Initial program 81.7%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6481.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified81.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6491.8%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr91.8%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. cos-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
      4. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      11. cos-lowering-cos.f6499.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.7%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
    9. Step-by-step derivation
      1. sub-negN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      4. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      5. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      6. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      7. neg-sub0N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      8. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      12. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
      13. cos-lowering-cos.f6499.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    10. Applied egg-rr99.7%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
    11. Applied egg-rr91.9%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\frac{1}{\frac{1}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}}} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -1.28 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}\\ \mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\frac{1}{\frac{1}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}}\\ \end{array} \]
  5. Add Preprocessing

Alternative 9: 93.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \sin \phi_2\\ t_1 := \cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)\\ t_2 := \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\phi_2 \leq -3.4 \cdot 10^{-6}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(0 - \sin \phi_1, t\_2, t\_0\right)}\\ \mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_1}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \sin \phi_1 \cdot t\_2}\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi1) (sin phi2)))
        (t_1
         (*
          (cos phi2)
          (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1)))))
        (t_2 (* (cos phi2) (cos (- lambda1 lambda2)))))
   (if (<= phi2 -3.4e-6)
     (atan2 t_1 (fma (- 0.0 (sin phi1)) t_2 t_0))
     (if (<= phi2 2.8e-55)
       (atan2
        t_1
        (-
         (* phi2 (cos phi1))
         (*
          (sin phi1)
          (+
           (* (cos lambda1) (cos lambda2))
           (* (sin lambda2) (sin lambda1))))))
       (atan2 t_1 (- t_0 (* (sin phi1) t_2)))))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * sin(phi2);
	double t_1 = cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)));
	double t_2 = cos(phi2) * cos((lambda1 - lambda2));
	double tmp;
	if (phi2 <= -3.4e-6) {
		tmp = atan2(t_1, fma((0.0 - sin(phi1)), t_2, t_0));
	} else if (phi2 <= 2.8e-55) {
		tmp = atan2(t_1, ((phi2 * cos(phi1)) - (sin(phi1) * ((cos(lambda1) * cos(lambda2)) + (sin(lambda2) * sin(lambda1))))));
	} else {
		tmp = atan2(t_1, (t_0 - (sin(phi1) * t_2)));
	}
	return tmp;
}
function code(lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * sin(phi2))
	t_1 = Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1))))
	t_2 = Float64(cos(phi2) * cos(Float64(lambda1 - lambda2)))
	tmp = 0.0
	if (phi2 <= -3.4e-6)
		tmp = atan(t_1, fma(Float64(0.0 - sin(phi1)), t_2, t_0));
	elseif (phi2 <= 2.8e-55)
		tmp = atan(t_1, Float64(Float64(phi2 * cos(phi1)) - Float64(sin(phi1) * Float64(Float64(cos(lambda1) * cos(lambda2)) + Float64(sin(lambda2) * sin(lambda1))))));
	else
		tmp = atan(t_1, Float64(t_0 - Float64(sin(phi1) * t_2)));
	end
	return tmp
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi2, -3.4e-6], N[ArcTan[t$95$1 / N[(N[(0.0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * t$95$2 + t$95$0), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi2, 2.8e-55], N[ArcTan[t$95$1 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[(N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[lambda2], $MachinePrecision] * N[Sin[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$1 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \sin \phi_2\\
t_1 := \cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)\\
t_2 := \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
\mathbf{if}\;\phi_2 \leq -3.4 \cdot 10^{-6}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\mathsf{fma}\left(0 - \sin \phi_1, t\_2, t\_0\right)}\\

\mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{t\_1}{t\_0 - \sin \phi_1 \cdot t\_2}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi2 < -3.40000000000000006e-6

    1. Initial program 76.4%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6476.4%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified76.4%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6491.2%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr91.2%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      2. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right) \]
      3. sub-negN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \color{blue}{\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right)}\right)\right) \]
      4. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
      6. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + \color{blue}{\cos \phi_1 \cdot \sin \phi_2}\right)\right) \]
      7. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      9. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
      10. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) + \color{blue}{\cos \phi_1} \cdot \sin \phi_2\right)\right) \]
    8. Applied egg-rr91.2%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}} \]

    if -3.40000000000000006e-6 < phi2 < 2.79999999999999984e-55

    1. Initial program 81.4%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6481.4%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified81.4%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6489.9%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr89.9%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Step-by-step derivation
      1. cos-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
      2. +-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
      4. fma-defineN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. fma-lowering-fma.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      9. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
      11. cos-lowering-cos.f6499.8%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
    8. Applied egg-rr99.8%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
    9. Taylor expanded in phi2 around 0

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\right) \]
    10. Step-by-step derivation
      1. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\phi_2 \cdot \cos \phi_1\right), \color{blue}{\left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)}\right)\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \cos \phi_1\right), \left(\color{blue}{\sin \phi_1} \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \left(\sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)}\right)\right)\right) \]
      5. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\color{blue}{\cos \lambda_1 \cdot \cos \lambda_2} + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\cos \lambda_1 \cdot \cos \lambda_2\right), \color{blue}{\left(\sin \lambda_1 \cdot \sin \lambda_2\right)}\right)\right)\right)\right) \]
      7. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\left(\cos \lambda_2 \cdot \cos \lambda_1\right), \left(\color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right), \left(\color{blue}{\sin \lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      9. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right), \left(\sin \color{blue}{\lambda_1} \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      10. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right) \]
      11. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\sin \lambda_1, \color{blue}{\sin \lambda_2}\right)\right)\right)\right)\right) \]
      12. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \sin \color{blue}{\lambda_2}\right)\right)\right)\right)\right) \]
      13. sin-lowering-sin.f6499.6%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right)\right)\right)\right) \]
    11. Simplified99.6%

      \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_2 \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \sin \lambda_2\right)}} \]

    if 2.79999999999999984e-55 < phi2

    1. Initial program 81.7%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6481.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified81.7%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right)\right) \]
      2. associate-*r*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
      4. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \phi_1\right)\right)\right) \]
      6. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
      8. sin-lowering-sin.f6481.7%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
    6. Applied egg-rr81.7%

      \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1}} \]
    7. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6491.8%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
    8. Applied egg-rr91.8%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification94.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -3.4 \cdot 10^{-6}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}\\ \mathbf{elif}\;\phi_2 \leq 2.8 \cdot 10^{-55}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_2 \cdot \sin \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 10: 88.8% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (atan2
  (*
   (cos phi2)
   (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
  (fma
   (- 0.0 (sin phi1))
   (* (cos phi2) (cos (- lambda1 lambda2)))
   (* (cos phi1) (sin phi2)))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), fma((0.0 - sin(phi1)), (cos(phi2) * cos((lambda1 - lambda2))), (cos(phi1) * sin(phi2))));
}
function code(lambda1, lambda2, phi1, phi2)
	return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), fma(Float64(0.0 - sin(phi1)), Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))), Float64(cos(phi1) * sin(phi2))))
end
code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(0.0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}
\end{array}
Derivation
  1. Initial program 80.2%

    \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
  2. Step-by-step derivation
    1. atan2-lowering-atan2.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
    2. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    3. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    4. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
    7. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    8. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    9. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
    10. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
    11. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
    12. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    13. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
    14. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
    15. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    17. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
    18. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
    19. --lowering--.f6480.2%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  3. Simplified80.2%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
  4. Add Preprocessing
  5. Step-by-step derivation
    1. sin-diffN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    2. --lowering--.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    4. sin-lowering-sin.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. *-lowering-*.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    7. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    8. sin-lowering-sin.f6490.9%

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
  6. Applied egg-rr90.9%

    \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
  7. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
    2. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right) \]
    3. sub-negN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \color{blue}{\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right)}\right)\right) \]
    4. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
    5. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \sin \phi_2 + \left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right) \]
    6. +-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + \color{blue}{\cos \phi_1 \cdot \sin \phi_2}\right)\right) \]
    7. associate-*l*N/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
    8. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
    9. *-commutativeN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) + \cos \color{blue}{\phi_1} \cdot \sin \phi_2\right)\right) \]
    10. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\left(\mathsf{neg}\left(\sin \phi_1\right)\right) \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) + \color{blue}{\cos \phi_1} \cdot \sin \phi_2\right)\right) \]
  8. Applied egg-rr90.9%

    \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)}} \]
  9. Final simplification90.9%

    \[\leadsto \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\mathsf{fma}\left(0 - \sin \phi_1, \cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right), \cos \phi_1 \cdot \sin \phi_2\right)} \]
  10. Add Preprocessing

Alternative 11: 88.7% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \lambda_2 \cdot \cos \lambda_1\\ t_1 := \cos \phi_1 \cdot \sin \phi_2\\ t_2 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_0\right)}{t\_1 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\ \mathbf{if}\;\lambda_1 \leq -3.75 \cdot 10^{-6}:\\ \;\;\;\;t\_2\\ \mathbf{elif}\;\lambda_1 \leq 8.8 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_0\right)}{t\_1 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_2 + \sin \lambda_2 \cdot \lambda_1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_2\\ \end{array} \end{array} \]
(FPCore (lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (sin lambda2) (cos lambda1)))
        (t_1 (* (cos phi1) (sin phi2)))
        (t_2
         (atan2
          (* (cos phi2) (- (* (sin lambda1) (cos lambda2)) t_0))
          (- t_1 (* (cos phi2) (* (cos lambda1) (sin phi1)))))))
   (if (<= lambda1 -3.75e-6)
     t_2
     (if (<= lambda1 8.8e-5)
       (atan2
        (* (cos phi2) (- (sin lambda1) t_0))
        (-
         t_1
         (*
          (cos phi2)
          (* (sin phi1) (+ (cos lambda2) (* (sin lambda2) lambda1))))))
       t_2))))
double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(lambda2) * cos(lambda1);
	double t_1 = cos(phi1) * sin(phi2);
	double t_2 = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_0)), (t_1 - (cos(phi2) * (cos(lambda1) * sin(phi1)))));
	double tmp;
	if (lambda1 <= -3.75e-6) {
		tmp = t_2;
	} else if (lambda1 <= 8.8e-5) {
		tmp = atan2((cos(phi2) * (sin(lambda1) - t_0)), (t_1 - (cos(phi2) * (sin(phi1) * (cos(lambda2) + (sin(lambda2) * lambda1))))));
	} else {
		tmp = t_2;
	}
	return tmp;
}
real(8) function code(lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    real(8) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    t_0 = sin(lambda2) * cos(lambda1)
    t_1 = cos(phi1) * sin(phi2)
    t_2 = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_0)), (t_1 - (cos(phi2) * (cos(lambda1) * sin(phi1)))))
    if (lambda1 <= (-3.75d-6)) then
        tmp = t_2
    else if (lambda1 <= 8.8d-5) then
        tmp = atan2((cos(phi2) * (sin(lambda1) - t_0)), (t_1 - (cos(phi2) * (sin(phi1) * (cos(lambda2) + (sin(lambda2) * lambda1))))))
    else
        tmp = t_2
    end if
    code = tmp
end function
public static double code(double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin(lambda2) * Math.cos(lambda1);
	double t_1 = Math.cos(phi1) * Math.sin(phi2);
	double t_2 = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - t_0)), (t_1 - (Math.cos(phi2) * (Math.cos(lambda1) * Math.sin(phi1)))));
	double tmp;
	if (lambda1 <= -3.75e-6) {
		tmp = t_2;
	} else if (lambda1 <= 8.8e-5) {
		tmp = Math.atan2((Math.cos(phi2) * (Math.sin(lambda1) - t_0)), (t_1 - (Math.cos(phi2) * (Math.sin(phi1) * (Math.cos(lambda2) + (Math.sin(lambda2) * lambda1))))));
	} else {
		tmp = t_2;
	}
	return tmp;
}
def code(lambda1, lambda2, phi1, phi2):
	t_0 = math.sin(lambda2) * math.cos(lambda1)
	t_1 = math.cos(phi1) * math.sin(phi2)
	t_2 = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - t_0)), (t_1 - (math.cos(phi2) * (math.cos(lambda1) * math.sin(phi1)))))
	tmp = 0
	if lambda1 <= -3.75e-6:
		tmp = t_2
	elif lambda1 <= 8.8e-5:
		tmp = math.atan2((math.cos(phi2) * (math.sin(lambda1) - t_0)), (t_1 - (math.cos(phi2) * (math.sin(phi1) * (math.cos(lambda2) + (math.sin(lambda2) * lambda1))))))
	else:
		tmp = t_2
	return tmp
function code(lambda1, lambda2, phi1, phi2)
	t_0 = Float64(sin(lambda2) * cos(lambda1))
	t_1 = Float64(cos(phi1) * sin(phi2))
	t_2 = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - t_0)), Float64(t_1 - Float64(cos(phi2) * Float64(cos(lambda1) * sin(phi1)))))
	tmp = 0.0
	if (lambda1 <= -3.75e-6)
		tmp = t_2;
	elseif (lambda1 <= 8.8e-5)
		tmp = atan(Float64(cos(phi2) * Float64(sin(lambda1) - t_0)), Float64(t_1 - Float64(cos(phi2) * Float64(sin(phi1) * Float64(cos(lambda2) + Float64(sin(lambda2) * lambda1))))));
	else
		tmp = t_2;
	end
	return tmp
end
function tmp_2 = code(lambda1, lambda2, phi1, phi2)
	t_0 = sin(lambda2) * cos(lambda1);
	t_1 = cos(phi1) * sin(phi2);
	t_2 = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_0)), (t_1 - (cos(phi2) * (cos(lambda1) * sin(phi1)))));
	tmp = 0.0;
	if (lambda1 <= -3.75e-6)
		tmp = t_2;
	elseif (lambda1 <= 8.8e-5)
		tmp = atan2((cos(phi2) * (sin(lambda1) - t_0)), (t_1 - (cos(phi2) * (sin(phi1) * (cos(lambda2) + (sin(lambda2) * lambda1))))));
	else
		tmp = t_2;
	end
	tmp_2 = tmp;
end
code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -3.75e-6], t$95$2, If[LessEqual[lambda1, 8.8e-5], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision] / N[(t$95$1 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] + N[(N[Sin[lambda2], $MachinePrecision] * lambda1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$2]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \lambda_2 \cdot \cos \lambda_1\\
t_1 := \cos \phi_1 \cdot \sin \phi_2\\
t_2 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_0\right)}{t\_1 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\
\mathbf{if}\;\lambda_1 \leq -3.75 \cdot 10^{-6}:\\
\;\;\;\;t\_2\\

\mathbf{elif}\;\lambda_1 \leq 8.8 \cdot 10^{-5}:\\
\;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_0\right)}{t\_1 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_2 + \sin \lambda_2 \cdot \lambda_1\right)\right)}\\

\mathbf{else}:\\
\;\;\;\;t\_2\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda1 < -3.7500000000000001e-6 or 8.7999999999999998e-5 < lambda1

    1. Initial program 57.4%

      \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
    2. Step-by-step derivation
      1. atan2-lowering-atan2.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
      2. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      3. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
      7. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      8. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      9. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
      10. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
      11. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
      12. associate-*l*N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      13. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
      14. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
      15. *-commutativeN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      17. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
      18. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6457.4%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    3. Simplified57.4%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. sin-diffN/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      2. --lowering--.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      4. sin-lowering-sin.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      5. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. *-lowering-*.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      7. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. sin-lowering-sin.f6481.0%

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr81.0%

      \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
    7. Taylor expanded in lambda1 around inf

      \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\color{blue}{\lambda_1}\right)\right)\right)\right)\right) \]
    8. Step-by-step derivation
      1. Simplified81.2%

        \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \color{blue}{\lambda_1}\right)} \]

      if -3.7500000000000001e-6 < lambda1 < 8.7999999999999998e-5

      1. Initial program 99.0%

        \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        3. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        6. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. associate-*l*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
        12. associate-*l*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
        14. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        17. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        18. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6499.0%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. Simplified99.0%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. sin-diffN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        2. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        4. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        7. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        8. sin-lowering-sin.f6499.1%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. Applied egg-rr99.1%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
      7. Taylor expanded in lambda2 around 0

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      8. Step-by-step derivation
        1. sin-lowering-sin.f6499.1%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      9. Simplified99.1%

        \[\leadsto \tan^{-1}_* \frac{\left(\color{blue}{\sin \lambda_1} - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
      10. Taylor expanded in lambda1 around 0

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \color{blue}{\left(\cos \left(\mathsf{neg}\left(\lambda_2\right)\right) + -1 \cdot \left(\lambda_1 \cdot \sin \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)}\right)\right)\right)\right) \]
      11. Step-by-step derivation
        1. cos-negN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_2 + \color{blue}{-1} \cdot \left(\lambda_1 \cdot \sin \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right)\right)\right) \]
        2. +-lowering-+.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\cos \lambda_2, \color{blue}{\left(-1 \cdot \left(\lambda_1 \cdot \sin \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)}\right)\right)\right)\right)\right) \]
        3. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \left(\color{blue}{-1} \cdot \left(\lambda_1 \cdot \sin \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
        4. mul-1-negN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \left(\mathsf{neg}\left(\lambda_1 \cdot \sin \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
        5. distribute-rgt-neg-inN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \left(\lambda_1 \cdot \color{blue}{\left(\mathsf{neg}\left(\sin \left(\mathsf{neg}\left(\lambda_2\right)\right)\right)\right)}\right)\right)\right)\right)\right)\right) \]
        6. sin-negN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \left(\lambda_1 \cdot \left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right)\right)\right)\right)\right)\right)\right)\right)\right) \]
        7. remove-double-negN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \left(\lambda_1 \cdot \sin \lambda_2\right)\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{*.f64}\left(\lambda_1, \color{blue}{\sin \lambda_2}\right)\right)\right)\right)\right)\right) \]
        9. sin-lowering-sin.f6499.1%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{+.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{*.f64}\left(\lambda_1, \mathsf{sin.f64}\left(\lambda_2\right)\right)\right)\right)\right)\right)\right) \]
      12. Simplified99.1%

        \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \lambda_2 + \lambda_1 \cdot \sin \lambda_2\right)}\right)} \]
    9. Recombined 2 regimes into one program.
    10. Final simplification91.0%

      \[\leadsto \begin{array}{l} \mathbf{if}\;\lambda_1 \leq -3.75 \cdot 10^{-6}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\ \mathbf{elif}\;\lambda_1 \leq 8.8 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \left(\cos \lambda_2 + \sin \lambda_2 \cdot \lambda_1\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\ \end{array} \]
    11. Add Preprocessing

    Alternative 12: 88.7% accurate, 0.7× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \sin \phi_2\\ t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{t\_0 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\ \mathbf{if}\;\lambda_1 \leq -6.4 \cdot 10^{-7}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\lambda_1 \leq 9 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 - \sin \lambda_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
    (FPCore (lambda1 lambda2 phi1 phi2)
     :precision binary64
     (let* ((t_0 (* (cos phi1) (sin phi2)))
            (t_1
             (atan2
              (*
               (cos phi2)
               (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
              (- t_0 (* (cos phi2) (* (cos lambda1) (sin phi1)))))))
       (if (<= lambda1 -6.4e-7)
         t_1
         (if (<= lambda1 9e-5)
           (atan2
            (* (cos phi2) (- lambda1 (sin lambda2)))
            (- t_0 (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))
           t_1))))
    double code(double lambda1, double lambda2, double phi1, double phi2) {
    	double t_0 = cos(phi1) * sin(phi2);
    	double t_1 = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), (t_0 - (cos(phi2) * (cos(lambda1) * sin(phi1)))));
    	double tmp;
    	if (lambda1 <= -6.4e-7) {
    		tmp = t_1;
    	} else if (lambda1 <= 9e-5) {
    		tmp = atan2((cos(phi2) * (lambda1 - sin(lambda2))), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    real(8) function code(lambda1, lambda2, phi1, phi2)
        real(8), intent (in) :: lambda1
        real(8), intent (in) :: lambda2
        real(8), intent (in) :: phi1
        real(8), intent (in) :: phi2
        real(8) :: t_0
        real(8) :: t_1
        real(8) :: tmp
        t_0 = cos(phi1) * sin(phi2)
        t_1 = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), (t_0 - (cos(phi2) * (cos(lambda1) * sin(phi1)))))
        if (lambda1 <= (-6.4d-7)) then
            tmp = t_1
        else if (lambda1 <= 9d-5) then
            tmp = atan2((cos(phi2) * (lambda1 - sin(lambda2))), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))))
        else
            tmp = t_1
        end if
        code = tmp
    end function
    
    public static double code(double lambda1, double lambda2, double phi1, double phi2) {
    	double t_0 = Math.cos(phi1) * Math.sin(phi2);
    	double t_1 = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.sin(lambda2) * Math.cos(lambda1)))), (t_0 - (Math.cos(phi2) * (Math.cos(lambda1) * Math.sin(phi1)))));
    	double tmp;
    	if (lambda1 <= -6.4e-7) {
    		tmp = t_1;
    	} else if (lambda1 <= 9e-5) {
    		tmp = Math.atan2((Math.cos(phi2) * (lambda1 - Math.sin(lambda2))), (t_0 - (Math.cos(phi2) * (Math.sin(phi1) * Math.cos((lambda1 - lambda2))))));
    	} else {
    		tmp = t_1;
    	}
    	return tmp;
    }
    
    def code(lambda1, lambda2, phi1, phi2):
    	t_0 = math.cos(phi1) * math.sin(phi2)
    	t_1 = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.sin(lambda2) * math.cos(lambda1)))), (t_0 - (math.cos(phi2) * (math.cos(lambda1) * math.sin(phi1)))))
    	tmp = 0
    	if lambda1 <= -6.4e-7:
    		tmp = t_1
    	elif lambda1 <= 9e-5:
    		tmp = math.atan2((math.cos(phi2) * (lambda1 - math.sin(lambda2))), (t_0 - (math.cos(phi2) * (math.sin(phi1) * math.cos((lambda1 - lambda2))))))
    	else:
    		tmp = t_1
    	return tmp
    
    function code(lambda1, lambda2, phi1, phi2)
    	t_0 = Float64(cos(phi1) * sin(phi2))
    	t_1 = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), Float64(t_0 - Float64(cos(phi2) * Float64(cos(lambda1) * sin(phi1)))))
    	tmp = 0.0
    	if (lambda1 <= -6.4e-7)
    		tmp = t_1;
    	elseif (lambda1 <= 9e-5)
    		tmp = atan(Float64(cos(phi2) * Float64(lambda1 - sin(lambda2))), Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))));
    	else
    		tmp = t_1;
    	end
    	return tmp
    end
    
    function tmp_2 = code(lambda1, lambda2, phi1, phi2)
    	t_0 = cos(phi1) * sin(phi2);
    	t_1 = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), (t_0 - (cos(phi2) * (cos(lambda1) * sin(phi1)))));
    	tmp = 0.0;
    	if (lambda1 <= -6.4e-7)
    		tmp = t_1;
    	elseif (lambda1 <= 9e-5)
    		tmp = atan2((cos(phi2) * (lambda1 - sin(lambda2))), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
    	else
    		tmp = t_1;
    	end
    	tmp_2 = tmp;
    end
    
    code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[lambda1, -6.4e-7], t$95$1, If[LessEqual[lambda1, 9e-5], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(lambda1 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \cos \phi_1 \cdot \sin \phi_2\\
    t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{t\_0 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\
    \mathbf{if}\;\lambda_1 \leq -6.4 \cdot 10^{-7}:\\
    \;\;\;\;t\_1\\
    
    \mathbf{elif}\;\lambda_1 \leq 9 \cdot 10^{-5}:\\
    \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 - \sin \lambda_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if lambda1 < -6.4000000000000001e-7 or 9.00000000000000057e-5 < lambda1

      1. Initial program 57.4%

        \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        3. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        6. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. associate-*l*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
        12. associate-*l*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
        14. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        17. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        18. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6457.4%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. Simplified57.4%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. sin-diffN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        2. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        4. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        7. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        8. sin-lowering-sin.f6481.0%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. Applied egg-rr81.0%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
      7. Taylor expanded in lambda1 around inf

        \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\color{blue}{\lambda_1}\right)\right)\right)\right)\right) \]
      8. Step-by-step derivation
        1. Simplified81.2%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \color{blue}{\lambda_1}\right)} \]

        if -6.4000000000000001e-7 < lambda1 < 9.00000000000000057e-5

        1. Initial program 99.0%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6499.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified99.0%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6499.1%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr99.1%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Taylor expanded in lambda2 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        8. Step-by-step derivation
          1. sin-lowering-sin.f6499.1%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        9. Simplified99.1%

          \[\leadsto \tan^{-1}_* \frac{\left(\color{blue}{\sin \lambda_1} - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        10. Taylor expanded in lambda1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\left(\lambda_1 - \sin \lambda_2\right)}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        11. Step-by-step derivation
          1. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. sin-lowering-sin.f6499.1%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        12. Simplified99.1%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\lambda_1 - \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
      9. Recombined 2 regimes into one program.
      10. Final simplification91.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\lambda_1 \leq -6.4 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\ \mathbf{elif}\;\lambda_1 \leq 9 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\lambda_1 - \sin \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\ \end{array} \]
      11. Add Preprocessing

      Alternative 13: 88.8% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (atan2
        (*
         (cos phi2)
         (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
        (-
         (* (cos phi1) (sin phi2))
         (* (sin phi1) (* (cos phi2) (cos (- lambda1 lambda2)))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * (cos(phi2) * cos((lambda1 - lambda2))))));
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          code = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * (cos(phi2) * cos((lambda1 - lambda2))))))
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.sin(lambda2) * Math.cos(lambda1)))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * (Math.cos(phi2) * Math.cos((lambda1 - lambda2))))));
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	return math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.sin(lambda2) * math.cos(lambda1)))), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * (math.cos(phi2) * math.cos((lambda1 - lambda2))))))
      
      function code(lambda1, lambda2, phi1, phi2)
      	return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * Float64(cos(phi2) * cos(Float64(lambda1 - lambda2))))))
      end
      
      function tmp = code(lambda1, lambda2, phi1, phi2)
      	tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * (cos(phi2) * cos((lambda1 - lambda2))))));
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}
      \end{array}
      
      Derivation
      1. Initial program 80.2%

        \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        3. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        6. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. associate-*l*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
        12. associate-*l*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
        14. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        17. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        18. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6480.2%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. Simplified80.2%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right)\right) \]
        2. associate-*r*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \phi_1\right)\right)\right) \]
        6. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
        8. sin-lowering-sin.f6480.2%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      6. Applied egg-rr80.2%

        \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1}} \]
      7. Step-by-step derivation
        1. sin-diffN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        2. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        4. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        7. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        8. sin-lowering-sin.f6490.9%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
      8. Applied egg-rr90.9%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1} \]
      9. Final simplification90.9%

        \[\leadsto \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
      10. Add Preprocessing

      Alternative 14: 88.8% accurate, 0.7× speedup?

      \[\begin{array}{l} \\ \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (atan2
        (*
         (cos phi2)
         (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
        (-
         (* (cos phi1) (sin phi2))
         (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2)))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          code = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))))
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	return Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.sin(lambda2) * Math.cos(lambda1)))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.cos(phi2) * (Math.sin(phi1) * Math.cos((lambda1 - lambda2))))));
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	return math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.sin(lambda2) * math.cos(lambda1)))), ((math.cos(phi1) * math.sin(phi2)) - (math.cos(phi2) * (math.sin(phi1) * math.cos((lambda1 - lambda2))))))
      
      function code(lambda1, lambda2, phi1, phi2)
      	return atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))))
      end
      
      function tmp = code(lambda1, lambda2, phi1, phi2)
      	tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}
      \end{array}
      
      Derivation
      1. Initial program 80.2%

        \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
      2. Step-by-step derivation
        1. atan2-lowering-atan2.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        3. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
        6. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        8. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        9. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
        10. associate-*l*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
        12. associate-*l*N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
        13. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
        14. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
        15. *-commutativeN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        16. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        17. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
        18. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6480.2%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      3. Simplified80.2%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
      4. Add Preprocessing
      5. Step-by-step derivation
        1. sin-diffN/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        2. --lowering--.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        4. sin-lowering-sin.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        5. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. *-lowering-*.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        7. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        8. sin-lowering-sin.f6490.9%

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
      6. Applied egg-rr90.9%

        \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
      7. Final simplification90.9%

        \[\leadsto \tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
      8. Add Preprocessing

      Alternative 15: 87.4% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \sin \phi_2\\ t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_2 := \sin \lambda_2 \cdot \cos \lambda_1\\ \mathbf{if}\;\phi_1 \leq -2.3 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_1\right)}\\ \mathbf{elif}\;\phi_1 \leq 1.8 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_2\right)}{\frac{\sin \phi_2 \cdot 2 - \sin \phi_1 \cdot \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\lambda_2 + \left(\phi_2 - \lambda_1\right)\right)\right)}{2}}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot t\_1\right)}\\ \end{array} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0 (* (cos phi1) (sin phi2)))
              (t_1 (cos (- lambda1 lambda2)))
              (t_2 (* (sin lambda2) (cos lambda1))))
         (if (<= phi1 -2.3e-11)
           (atan2
            (* (cos phi2) (- (sin lambda1) t_2))
            (- t_0 (* (cos phi2) (* (sin phi1) t_1))))
           (if (<= phi1 1.8e-7)
             (atan2
              (* (cos phi2) (- (* (sin lambda1) (cos lambda2)) t_2))
              (/
               (-
                (* (sin phi2) 2.0)
                (*
                 (sin phi1)
                 (+
                  (cos (+ phi2 (- lambda1 lambda2)))
                  (cos (+ lambda2 (- phi2 lambda1))))))
               2.0))
             (atan2
              (* (cos phi2) (sin (- lambda1 lambda2)))
              (- t_0 (* (sin phi1) (* (cos phi2) t_1))))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = cos(phi1) * sin(phi2);
      	double t_1 = cos((lambda1 - lambda2));
      	double t_2 = sin(lambda2) * cos(lambda1);
      	double tmp;
      	if (phi1 <= -2.3e-11) {
      		tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), (t_0 - (cos(phi2) * (sin(phi1) * t_1))));
      	} else if (phi1 <= 1.8e-7) {
      		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (((sin(phi2) * 2.0) - (sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1)))))) / 2.0));
      	} else {
      		tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(phi2) * t_1))));
      	}
      	return tmp;
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          real(8) :: t_0
          real(8) :: t_1
          real(8) :: t_2
          real(8) :: tmp
          t_0 = cos(phi1) * sin(phi2)
          t_1 = cos((lambda1 - lambda2))
          t_2 = sin(lambda2) * cos(lambda1)
          if (phi1 <= (-2.3d-11)) then
              tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), (t_0 - (cos(phi2) * (sin(phi1) * t_1))))
          else if (phi1 <= 1.8d-7) then
              tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (((sin(phi2) * 2.0d0) - (sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1)))))) / 2.0d0))
          else
              tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(phi2) * t_1))))
          end if
          code = tmp
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = Math.cos(phi1) * Math.sin(phi2);
      	double t_1 = Math.cos((lambda1 - lambda2));
      	double t_2 = Math.sin(lambda2) * Math.cos(lambda1);
      	double tmp;
      	if (phi1 <= -2.3e-11) {
      		tmp = Math.atan2((Math.cos(phi2) * (Math.sin(lambda1) - t_2)), (t_0 - (Math.cos(phi2) * (Math.sin(phi1) * t_1))));
      	} else if (phi1 <= 1.8e-7) {
      		tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - t_2)), (((Math.sin(phi2) * 2.0) - (Math.sin(phi1) * (Math.cos((phi2 + (lambda1 - lambda2))) + Math.cos((lambda2 + (phi2 - lambda1)))))) / 2.0));
      	} else {
      		tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.sin(phi1) * (Math.cos(phi2) * t_1))));
      	}
      	return tmp;
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	t_0 = math.cos(phi1) * math.sin(phi2)
      	t_1 = math.cos((lambda1 - lambda2))
      	t_2 = math.sin(lambda2) * math.cos(lambda1)
      	tmp = 0
      	if phi1 <= -2.3e-11:
      		tmp = math.atan2((math.cos(phi2) * (math.sin(lambda1) - t_2)), (t_0 - (math.cos(phi2) * (math.sin(phi1) * t_1))))
      	elif phi1 <= 1.8e-7:
      		tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - t_2)), (((math.sin(phi2) * 2.0) - (math.sin(phi1) * (math.cos((phi2 + (lambda1 - lambda2))) + math.cos((lambda2 + (phi2 - lambda1)))))) / 2.0))
      	else:
      		tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.sin(phi1) * (math.cos(phi2) * t_1))))
      	return tmp
      
      function code(lambda1, lambda2, phi1, phi2)
      	t_0 = Float64(cos(phi1) * sin(phi2))
      	t_1 = cos(Float64(lambda1 - lambda2))
      	t_2 = Float64(sin(lambda2) * cos(lambda1))
      	tmp = 0.0
      	if (phi1 <= -2.3e-11)
      		tmp = atan(Float64(cos(phi2) * Float64(sin(lambda1) - t_2)), Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * t_1))));
      	elseif (phi1 <= 1.8e-7)
      		tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - t_2)), Float64(Float64(Float64(sin(phi2) * 2.0) - Float64(sin(phi1) * Float64(cos(Float64(phi2 + Float64(lambda1 - lambda2))) + cos(Float64(lambda2 + Float64(phi2 - lambda1)))))) / 2.0));
      	else
      		tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(sin(phi1) * Float64(cos(phi2) * t_1))));
      	end
      	return tmp
      end
      
      function tmp_2 = code(lambda1, lambda2, phi1, phi2)
      	t_0 = cos(phi1) * sin(phi2);
      	t_1 = cos((lambda1 - lambda2));
      	t_2 = sin(lambda2) * cos(lambda1);
      	tmp = 0.0;
      	if (phi1 <= -2.3e-11)
      		tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), (t_0 - (cos(phi2) * (sin(phi1) * t_1))));
      	elseif (phi1 <= 1.8e-7)
      		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (((sin(phi2) * 2.0) - (sin(phi1) * (cos((phi2 + (lambda1 - lambda2))) + cos((lambda2 + (phi2 - lambda1)))))) / 2.0));
      	else
      		tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(phi2) * t_1))));
      	end
      	tmp_2 = tmp;
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -2.3e-11], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 1.8e-7], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[Sin[phi2], $MachinePrecision] * 2.0), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[N[(phi2 + N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[Cos[N[(lambda2 + N[(phi2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos \phi_1 \cdot \sin \phi_2\\
      t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
      t_2 := \sin \lambda_2 \cdot \cos \lambda_1\\
      \mathbf{if}\;\phi_1 \leq -2.3 \cdot 10^{-11}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_1\right)}\\
      
      \mathbf{elif}\;\phi_1 \leq 1.8 \cdot 10^{-7}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_2\right)}{\frac{\sin \phi_2 \cdot 2 - \sin \phi_1 \cdot \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\lambda_2 + \left(\phi_2 - \lambda_1\right)\right)\right)}{2}}\\
      
      \mathbf{else}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot t\_1\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if phi1 < -2.30000000000000014e-11

        1. Initial program 81.6%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6481.6%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified81.6%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6484.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr84.8%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Taylor expanded in lambda2 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        8. Step-by-step derivation
          1. sin-lowering-sin.f6483.3%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        9. Simplified83.3%

          \[\leadsto \tan^{-1}_* \frac{\left(\color{blue}{\sin \lambda_1} - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]

        if -2.30000000000000014e-11 < phi1 < 1.79999999999999997e-7

        1. Initial program 81.1%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6481.1%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified81.1%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6499.4%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr99.4%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\sin \phi_2 \cdot \cos \phi_1 - \color{blue}{\cos \phi_2} \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          2. sin-cos-multN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\frac{\sin \left(\phi_2 - \phi_1\right) + \sin \left(\phi_2 + \phi_1\right)}{2} - \color{blue}{\cos \phi_2} \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\frac{\sin \left(\phi_2 - \phi_1\right) + \sin \left(\phi_2 + \phi_1\right)}{2} - \cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          4. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\frac{\sin \left(\phi_2 - \phi_1\right) + \sin \left(\phi_2 + \phi_1\right)}{2} - \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right) \]
          5. cos-multN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\frac{\sin \left(\phi_2 - \phi_1\right) + \sin \left(\phi_2 + \phi_1\right)}{2} - \frac{\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\phi_2 - \left(\lambda_1 - \lambda_2\right)\right)}{2} \cdot \sin \color{blue}{\phi_1}\right)\right) \]
          6. associate-*l/N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\frac{\sin \left(\phi_2 - \phi_1\right) + \sin \left(\phi_2 + \phi_1\right)}{2} - \frac{\left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\phi_2 - \left(\lambda_1 - \lambda_2\right)\right)\right) \cdot \sin \phi_1}{\color{blue}{2}}\right)\right) \]
          7. sub-divN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\frac{\left(\sin \left(\phi_2 - \phi_1\right) + \sin \left(\phi_2 + \phi_1\right)\right) - \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\phi_2 - \left(\lambda_1 - \lambda_2\right)\right)\right) \cdot \sin \phi_1}{\color{blue}{2}}\right)\right) \]
          8. /-lowering-/.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\left(\left(\sin \left(\phi_2 - \phi_1\right) + \sin \left(\phi_2 + \phi_1\right)\right) - \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\phi_2 - \left(\lambda_1 - \lambda_2\right)\right)\right) \cdot \sin \phi_1\right), \color{blue}{2}\right)\right) \]
        8. Applied egg-rr99.4%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\frac{\left(\sin \left(\phi_2 - \phi_1\right) + \sin \left(\phi_2 + \phi_1\right)\right) - \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\left(\phi_2 - \lambda_1\right) + \lambda_2\right)\right) \cdot \sin \phi_1}{2}}} \]
        9. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\left(2 \cdot \sin \phi_2\right)}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(\phi_2, \mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\phi_2, \lambda_1\right), \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right), 2\right)\right) \]
        10. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\left(\sin \phi_2 \cdot 2\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(\phi_2, \mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\phi_2, \lambda_1\right), \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right), 2\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \phi_2, 2\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(\phi_2, \mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\phi_2, \lambda_1\right), \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right), 2\right)\right) \]
          3. sin-lowering-sin.f6499.4%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_2\right), 2\right), \mathsf{*.f64}\left(\mathsf{+.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(\phi_2, \mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\phi_2, \lambda_1\right), \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right), 2\right)\right) \]
        11. Simplified99.4%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\frac{\color{blue}{\sin \phi_2 \cdot 2} - \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\left(\phi_2 - \lambda_1\right) + \lambda_2\right)\right) \cdot \sin \phi_1}{2}} \]

        if 1.79999999999999997e-7 < phi1

        1. Initial program 76.0%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6476.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified76.0%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right)\right) \]
          2. associate-*r*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \phi_1\right)\right)\right) \]
          6. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          8. sin-lowering-sin.f6476.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        6. Applied egg-rr76.0%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1}} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification90.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.3 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{elif}\;\phi_1 \leq 1.8 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\frac{\sin \phi_2 \cdot 2 - \sin \phi_1 \cdot \left(\cos \left(\phi_2 + \left(\lambda_1 - \lambda_2\right)\right) + \cos \left(\lambda_2 + \left(\phi_2 - \lambda_1\right)\right)\right)}{2}}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 16: 87.4% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \sin \phi_2\\ t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_2 := \sin \lambda_2 \cdot \cos \lambda_1\\ \mathbf{if}\;\phi_1 \leq -1.95 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_1\right)}\\ \mathbf{elif}\;\phi_1 \leq 2.7 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_2\right)}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot t\_1\right)}\\ \end{array} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0 (* (cos phi1) (sin phi2)))
              (t_1 (cos (- lambda1 lambda2)))
              (t_2 (* (sin lambda2) (cos lambda1))))
         (if (<= phi1 -1.95e-11)
           (atan2
            (* (cos phi2) (- (sin lambda1) t_2))
            (- t_0 (* (cos phi2) (* (sin phi1) t_1))))
           (if (<= phi1 2.7e-7)
             (atan2
              (* (cos phi2) (- (* (sin lambda1) (cos lambda2)) t_2))
              (- t_0 (* (sin phi1) (cos (- lambda2 lambda1)))))
             (atan2
              (* (cos phi2) (sin (- lambda1 lambda2)))
              (- t_0 (* (sin phi1) (* (cos phi2) t_1))))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = cos(phi1) * sin(phi2);
      	double t_1 = cos((lambda1 - lambda2));
      	double t_2 = sin(lambda2) * cos(lambda1);
      	double tmp;
      	if (phi1 <= -1.95e-11) {
      		tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), (t_0 - (cos(phi2) * (sin(phi1) * t_1))));
      	} else if (phi1 <= 2.7e-7) {
      		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (t_0 - (sin(phi1) * cos((lambda2 - lambda1)))));
      	} else {
      		tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(phi2) * t_1))));
      	}
      	return tmp;
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          real(8) :: t_0
          real(8) :: t_1
          real(8) :: t_2
          real(8) :: tmp
          t_0 = cos(phi1) * sin(phi2)
          t_1 = cos((lambda1 - lambda2))
          t_2 = sin(lambda2) * cos(lambda1)
          if (phi1 <= (-1.95d-11)) then
              tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), (t_0 - (cos(phi2) * (sin(phi1) * t_1))))
          else if (phi1 <= 2.7d-7) then
              tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (t_0 - (sin(phi1) * cos((lambda2 - lambda1)))))
          else
              tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(phi2) * t_1))))
          end if
          code = tmp
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = Math.cos(phi1) * Math.sin(phi2);
      	double t_1 = Math.cos((lambda1 - lambda2));
      	double t_2 = Math.sin(lambda2) * Math.cos(lambda1);
      	double tmp;
      	if (phi1 <= -1.95e-11) {
      		tmp = Math.atan2((Math.cos(phi2) * (Math.sin(lambda1) - t_2)), (t_0 - (Math.cos(phi2) * (Math.sin(phi1) * t_1))));
      	} else if (phi1 <= 2.7e-7) {
      		tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - t_2)), (t_0 - (Math.sin(phi1) * Math.cos((lambda2 - lambda1)))));
      	} else {
      		tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.sin(phi1) * (Math.cos(phi2) * t_1))));
      	}
      	return tmp;
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	t_0 = math.cos(phi1) * math.sin(phi2)
      	t_1 = math.cos((lambda1 - lambda2))
      	t_2 = math.sin(lambda2) * math.cos(lambda1)
      	tmp = 0
      	if phi1 <= -1.95e-11:
      		tmp = math.atan2((math.cos(phi2) * (math.sin(lambda1) - t_2)), (t_0 - (math.cos(phi2) * (math.sin(phi1) * t_1))))
      	elif phi1 <= 2.7e-7:
      		tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - t_2)), (t_0 - (math.sin(phi1) * math.cos((lambda2 - lambda1)))))
      	else:
      		tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.sin(phi1) * (math.cos(phi2) * t_1))))
      	return tmp
      
      function code(lambda1, lambda2, phi1, phi2)
      	t_0 = Float64(cos(phi1) * sin(phi2))
      	t_1 = cos(Float64(lambda1 - lambda2))
      	t_2 = Float64(sin(lambda2) * cos(lambda1))
      	tmp = 0.0
      	if (phi1 <= -1.95e-11)
      		tmp = atan(Float64(cos(phi2) * Float64(sin(lambda1) - t_2)), Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * t_1))));
      	elseif (phi1 <= 2.7e-7)
      		tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - t_2)), Float64(t_0 - Float64(sin(phi1) * cos(Float64(lambda2 - lambda1)))));
      	else
      		tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(sin(phi1) * Float64(cos(phi2) * t_1))));
      	end
      	return tmp
      end
      
      function tmp_2 = code(lambda1, lambda2, phi1, phi2)
      	t_0 = cos(phi1) * sin(phi2);
      	t_1 = cos((lambda1 - lambda2));
      	t_2 = sin(lambda2) * cos(lambda1);
      	tmp = 0.0;
      	if (phi1 <= -1.95e-11)
      		tmp = atan2((cos(phi2) * (sin(lambda1) - t_2)), (t_0 - (cos(phi2) * (sin(phi1) * t_1))));
      	elseif (phi1 <= 2.7e-7)
      		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - t_2)), (t_0 - (sin(phi1) * cos((lambda2 - lambda1)))));
      	else
      		tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(phi2) * t_1))));
      	end
      	tmp_2 = tmp;
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -1.95e-11], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 2.7e-7], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - t$95$2), $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos \phi_1 \cdot \sin \phi_2\\
      t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
      t_2 := \sin \lambda_2 \cdot \cos \lambda_1\\
      \mathbf{if}\;\phi_1 \leq -1.95 \cdot 10^{-11}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - t\_2\right)}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_1\right)}\\
      
      \mathbf{elif}\;\phi_1 \leq 2.7 \cdot 10^{-7}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - t\_2\right)}{t\_0 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot t\_1\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if phi1 < -1.95000000000000005e-11

        1. Initial program 81.6%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6481.6%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified81.6%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6484.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr84.8%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Taylor expanded in lambda2 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        8. Step-by-step derivation
          1. sin-lowering-sin.f6483.3%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        9. Simplified83.3%

          \[\leadsto \tan^{-1}_* \frac{\left(\color{blue}{\sin \lambda_1} - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]

        if -1.95000000000000005e-11 < phi1 < 2.70000000000000009e-7

        1. Initial program 81.1%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6481.1%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified81.1%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6499.4%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr99.4%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Taylor expanded in phi2 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right) \]
        8. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
          2. sub-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          3. remove-double-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          4. mul-1-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(-1 \cdot \lambda_1\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          5. distribute-neg-inN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(-1 \cdot \lambda_1 + \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          6. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          7. cos-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_2 + -1 \cdot \lambda_1\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
          9. mul-1-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + \left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          10. unsub-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 - \lambda_1\right)\right), \sin \phi_1\right)\right)\right) \]
          11. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \sin \phi_1\right)\right)\right) \]
          12. sin-lowering-sin.f6499.3%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        9. Simplified99.3%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\cos \left(\lambda_2 - \lambda_1\right) \cdot \sin \phi_1}} \]

        if 2.70000000000000009e-7 < phi1

        1. Initial program 76.0%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6476.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified76.0%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right)\right) \]
          2. associate-*r*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \phi_1\right)\right)\right) \]
          6. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          8. sin-lowering-sin.f6476.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        6. Applied egg-rr76.0%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1}} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification89.9%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -1.95 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{elif}\;\phi_1 \leq 2.7 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 17: 85.9% accurate, 0.8× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\\ \mathbf{if}\;\phi_1 \leq -4.3 \cdot 10^{-13}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{t\_0}\\ \mathbf{elif}\;\phi_1 \leq 2.5 \cdot 10^{-48}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0}\\ \end{array} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0
               (-
                (* (cos phi1) (sin phi2))
                (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2)))))))
         (if (<= phi1 -4.3e-13)
           (atan2
            (* (cos phi2) (- (sin lambda1) (* (sin lambda2) (cos lambda1))))
            t_0)
           (if (<= phi1 2.5e-48)
             (atan2
              (*
               (fma
                (- 0.0 (sin lambda2))
                (cos lambda1)
                (* (sin lambda1) (cos lambda2)))
               (cos phi2))
              (sin phi2))
             (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) t_0)))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = (cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))));
      	double tmp;
      	if (phi1 <= -4.3e-13) {
      		tmp = atan2((cos(phi2) * (sin(lambda1) - (sin(lambda2) * cos(lambda1)))), t_0);
      	} else if (phi1 <= 2.5e-48) {
      		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), (sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
      	} else {
      		tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), t_0);
      	}
      	return tmp;
      }
      
      function code(lambda1, lambda2, phi1, phi2)
      	t_0 = Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))))
      	tmp = 0.0
      	if (phi1 <= -4.3e-13)
      		tmp = atan(Float64(cos(phi2) * Float64(sin(lambda1) - Float64(sin(lambda2) * cos(lambda1)))), t_0);
      	elseif (phi1 <= 2.5e-48)
      		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), Float64(sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
      	else
      		tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), t_0);
      	end
      	return tmp
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -4.3e-13], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[lambda1], $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$0], $MachinePrecision], If[LessEqual[phi1, 2.5e-48], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / t$95$0], $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\\
      \mathbf{if}\;\phi_1 \leq -4.3 \cdot 10^{-13}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{t\_0}\\
      
      \mathbf{elif}\;\phi_1 \leq 2.5 \cdot 10^{-48}:\\
      \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
      
      \mathbf{else}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if phi1 < -4.2999999999999999e-13

        1. Initial program 81.6%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6481.6%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified81.6%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6484.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr84.8%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Taylor expanded in lambda2 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        8. Step-by-step derivation
          1. sin-lowering-sin.f6483.3%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        9. Simplified83.3%

          \[\leadsto \tan^{-1}_* \frac{\left(\color{blue}{\sin \lambda_1} - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]

        if -4.2999999999999999e-13 < phi1 < 2.4999999999999999e-48

        1. Initial program 80.5%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6480.5%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified80.5%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6499.7%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr99.7%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Step-by-step derivation
          1. cos-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
          2. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
          4. fma-defineN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          10. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          11. cos-lowering-cos.f6499.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
        8. Applied egg-rr99.8%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
        9. Step-by-step derivation
          1. sub-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          2. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          4. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          5. fma-defineN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          6. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          7. neg-sub0N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          8. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          10. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          12. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          13. cos-lowering-cos.f6499.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
        10. Applied egg-rr99.8%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
        11. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
        12. Step-by-step derivation
          1. sin-lowering-sin.f6498.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
        13. Simplified98.8%

          \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]

        if 2.4999999999999999e-48 < phi1

        1. Initial program 77.9%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6477.9%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified77.9%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
      3. Recombined 3 regimes into one program.
      4. Final simplification89.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -4.3 \cdot 10^{-13}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{elif}\;\phi_1 \leq 2.5 \cdot 10^{-48}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 18: 85.6% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \sin \phi_2\\ t_1 := \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\ t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\phi_1 \leq -2.4 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 + \frac{\cos \phi_2}{\frac{-1}{t\_1}}}\\ \mathbf{elif}\;\phi_1 \leq 3 \cdot 10^{-47}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \cos \phi_2 \cdot t\_1}\\ \end{array} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0 (* (cos phi1) (sin phi2)))
              (t_1 (* (sin phi1) (cos (- lambda1 lambda2))))
              (t_2 (* (cos phi2) (sin (- lambda1 lambda2)))))
         (if (<= phi1 -2.4e-11)
           (atan2 t_2 (+ t_0 (/ (cos phi2) (/ -1.0 t_1))))
           (if (<= phi1 3e-47)
             (atan2
              (*
               (fma
                (- 0.0 (sin lambda2))
                (cos lambda1)
                (* (sin lambda1) (cos lambda2)))
               (cos phi2))
              (sin phi2))
             (atan2 t_2 (- t_0 (* (cos phi2) t_1)))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = cos(phi1) * sin(phi2);
      	double t_1 = sin(phi1) * cos((lambda1 - lambda2));
      	double t_2 = cos(phi2) * sin((lambda1 - lambda2));
      	double tmp;
      	if (phi1 <= -2.4e-11) {
      		tmp = atan2(t_2, (t_0 + (cos(phi2) / (-1.0 / t_1))));
      	} else if (phi1 <= 3e-47) {
      		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), (sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
      	} else {
      		tmp = atan2(t_2, (t_0 - (cos(phi2) * t_1)));
      	}
      	return tmp;
      }
      
      function code(lambda1, lambda2, phi1, phi2)
      	t_0 = Float64(cos(phi1) * sin(phi2))
      	t_1 = Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))
      	t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2)))
      	tmp = 0.0
      	if (phi1 <= -2.4e-11)
      		tmp = atan(t_2, Float64(t_0 + Float64(cos(phi2) / Float64(-1.0 / t_1))));
      	elseif (phi1 <= 3e-47)
      		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), Float64(sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
      	else
      		tmp = atan(t_2, Float64(t_0 - Float64(cos(phi2) * t_1)));
      	end
      	return tmp
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -2.4e-11], N[ArcTan[t$95$2 / N[(t$95$0 + N[(N[Cos[phi2], $MachinePrecision] / N[(-1.0 / t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 3e-47], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos \phi_1 \cdot \sin \phi_2\\
      t_1 := \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\
      t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
      \mathbf{if}\;\phi_1 \leq -2.4 \cdot 10^{-11}:\\
      \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 + \frac{\cos \phi_2}{\frac{-1}{t\_1}}}\\
      
      \mathbf{elif}\;\phi_1 \leq 3 \cdot 10^{-47}:\\
      \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
      
      \mathbf{else}:\\
      \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \cos \phi_2 \cdot t\_1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if phi1 < -2.4000000000000001e-11

        1. Initial program 82.7%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6482.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified82.8%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-cos-multN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \frac{\sin \left(\phi_1 - \left(\lambda_1 - \lambda_2\right)\right) + \sin \left(\phi_1 + \left(\lambda_1 - \lambda_2\right)\right)}{\color{blue}{2}}\right)\right)\right) \]
          2. clear-numN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \frac{1}{\color{blue}{\frac{2}{\sin \left(\phi_1 - \left(\lambda_1 - \lambda_2\right)\right) + \sin \left(\phi_1 + \left(\lambda_1 - \lambda_2\right)\right)}}}\right)\right)\right) \]
          3. un-div-invN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\cos \phi_2}{\color{blue}{\frac{2}{\sin \left(\phi_1 - \left(\lambda_1 - \lambda_2\right)\right) + \sin \left(\phi_1 + \left(\lambda_1 - \lambda_2\right)\right)}}}\right)\right)\right) \]
          4. /-lowering-/.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\cos \phi_2, \color{blue}{\left(\frac{2}{\sin \left(\phi_1 - \left(\lambda_1 - \lambda_2\right)\right) + \sin \left(\phi_1 + \left(\lambda_1 - \lambda_2\right)\right)}\right)}\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\frac{\color{blue}{2}}{\sin \left(\phi_1 - \left(\lambda_1 - \lambda_2\right)\right) + \sin \left(\phi_1 + \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right)\right) \]
          6. clear-numN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\frac{1}{\color{blue}{\frac{\sin \left(\phi_1 - \left(\lambda_1 - \lambda_2\right)\right) + \sin \left(\phi_1 + \left(\lambda_1 - \lambda_2\right)\right)}{2}}}\right)\right)\right)\right) \]
          7. sin-cos-multN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\frac{1}{\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}}\right)\right)\right)\right) \]
          8. /-lowering-/.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{/.f64}\left(1, \color{blue}{\left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right)\right) \]
          10. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right)\right) \]
          11. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right)\right) \]
          12. --lowering--.f6482.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{/.f64}\left(1, \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr82.8%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\frac{\cos \phi_2}{\frac{1}{\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}}} \]

        if -2.4000000000000001e-11 < phi1 < 3.00000000000000017e-47

        1. Initial program 79.8%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6479.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified79.8%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6499.5%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr99.5%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Step-by-step derivation
          1. cos-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
          2. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
          4. fma-defineN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          10. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          11. cos-lowering-cos.f6499.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
        8. Applied egg-rr99.8%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
        9. Step-by-step derivation
          1. sub-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          2. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          4. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          5. fma-defineN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          6. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          7. neg-sub0N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          8. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          10. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          12. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          13. cos-lowering-cos.f6499.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
        10. Applied egg-rr99.8%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
        11. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
        12. Step-by-step derivation
          1. sin-lowering-sin.f6498.6%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
        13. Simplified98.6%

          \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]

        if 3.00000000000000017e-47 < phi1

        1. Initial program 77.9%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6477.9%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified77.9%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
      3. Recombined 3 regimes into one program.
      4. Final simplification89.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.4 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 + \frac{\cos \phi_2}{\frac{-1}{\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}}\\ \mathbf{elif}\;\phi_1 \leq 3 \cdot 10^{-47}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 19: 85.6% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \sin \phi_2\\ t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\ t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\ \mathbf{if}\;\phi_1 \leq -2.7 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot t\_1\right)}\\ \mathbf{elif}\;\phi_1 \leq 3.4 \cdot 10^{-48}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_1\right)}\\ \end{array} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0 (* (cos phi1) (sin phi2)))
              (t_1 (cos (- lambda1 lambda2)))
              (t_2 (* (cos phi2) (sin (- lambda1 lambda2)))))
         (if (<= phi1 -2.7e-11)
           (atan2 t_2 (- t_0 (* (sin phi1) (* (cos phi2) t_1))))
           (if (<= phi1 3.4e-48)
             (atan2
              (*
               (fma
                (- 0.0 (sin lambda2))
                (cos lambda1)
                (* (sin lambda1) (cos lambda2)))
               (cos phi2))
              (sin phi2))
             (atan2 t_2 (- t_0 (* (cos phi2) (* (sin phi1) t_1))))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = cos(phi1) * sin(phi2);
      	double t_1 = cos((lambda1 - lambda2));
      	double t_2 = cos(phi2) * sin((lambda1 - lambda2));
      	double tmp;
      	if (phi1 <= -2.7e-11) {
      		tmp = atan2(t_2, (t_0 - (sin(phi1) * (cos(phi2) * t_1))));
      	} else if (phi1 <= 3.4e-48) {
      		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), (sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
      	} else {
      		tmp = atan2(t_2, (t_0 - (cos(phi2) * (sin(phi1) * t_1))));
      	}
      	return tmp;
      }
      
      function code(lambda1, lambda2, phi1, phi2)
      	t_0 = Float64(cos(phi1) * sin(phi2))
      	t_1 = cos(Float64(lambda1 - lambda2))
      	t_2 = Float64(cos(phi2) * sin(Float64(lambda1 - lambda2)))
      	tmp = 0.0
      	if (phi1 <= -2.7e-11)
      		tmp = atan(t_2, Float64(t_0 - Float64(sin(phi1) * Float64(cos(phi2) * t_1))));
      	elseif (phi1 <= 3.4e-48)
      		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), Float64(sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
      	else
      		tmp = atan(t_2, Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * t_1))));
      	end
      	return tmp
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[phi1, -2.7e-11], N[ArcTan[t$95$2 / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[phi1, 3.4e-48], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], N[ArcTan[t$95$2 / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos \phi_1 \cdot \sin \phi_2\\
      t_1 := \cos \left(\lambda_1 - \lambda_2\right)\\
      t_2 := \cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)\\
      \mathbf{if}\;\phi_1 \leq -2.7 \cdot 10^{-11}:\\
      \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot t\_1\right)}\\
      
      \mathbf{elif}\;\phi_1 \leq 3.4 \cdot 10^{-48}:\\
      \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
      
      \mathbf{else}:\\
      \;\;\;\;\tan^{-1}_* \frac{t\_2}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot t\_1\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if phi1 < -2.70000000000000005e-11

        1. Initial program 82.7%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6482.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified82.8%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right)\right) \]
          2. associate-*r*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \phi_1\right)\right)\right) \]
          6. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          8. sin-lowering-sin.f6482.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        6. Applied egg-rr82.8%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1}} \]

        if -2.70000000000000005e-11 < phi1 < 3.40000000000000028e-48

        1. Initial program 79.8%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6479.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified79.8%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6499.5%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr99.5%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Step-by-step derivation
          1. cos-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
          2. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
          4. fma-defineN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          10. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          11. cos-lowering-cos.f6499.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
        8. Applied egg-rr99.8%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
        9. Step-by-step derivation
          1. sub-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          2. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          4. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          5. fma-defineN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          6. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          7. neg-sub0N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          8. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          10. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          12. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          13. cos-lowering-cos.f6499.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
        10. Applied egg-rr99.8%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
        11. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
        12. Step-by-step derivation
          1. sin-lowering-sin.f6498.6%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
        13. Simplified98.6%

          \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]

        if 3.40000000000000028e-48 < phi1

        1. Initial program 77.9%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6477.9%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified77.9%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
      3. Recombined 3 regimes into one program.
      4. Final simplification89.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.7 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{elif}\;\phi_1 \leq 3.4 \cdot 10^{-48}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 20: 85.6% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{if}\;\phi_1 \leq -2.4 \cdot 10^{-11}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\phi_1 \leq 10^{-47}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0
               (atan2
                (* (cos phi2) (sin (- lambda1 lambda2)))
                (-
                 (* (cos phi1) (sin phi2))
                 (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))))
         (if (<= phi1 -2.4e-11)
           t_0
           (if (<= phi1 1e-47)
             (atan2
              (*
               (fma
                (- 0.0 (sin lambda2))
                (cos lambda1)
                (* (sin lambda1) (cos lambda2)))
               (cos phi2))
              (sin phi2))
             t_0))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
      	double tmp;
      	if (phi1 <= -2.4e-11) {
      		tmp = t_0;
      	} else if (phi1 <= 1e-47) {
      		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), (sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      function code(lambda1, lambda2, phi1, phi2)
      	t_0 = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))))
      	tmp = 0.0
      	if (phi1 <= -2.4e-11)
      		tmp = t_0;
      	elseif (phi1 <= 1e-47)
      		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), Float64(sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -2.4e-11], t$95$0, If[LessEqual[phi1, 1e-47], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\
      \mathbf{if}\;\phi_1 \leq -2.4 \cdot 10^{-11}:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;\phi_1 \leq 10^{-47}:\\
      \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if phi1 < -2.4000000000000001e-11 or 9.9999999999999997e-48 < phi1

        1. Initial program 80.4%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6480.5%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified80.5%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing

        if -2.4000000000000001e-11 < phi1 < 9.9999999999999997e-48

        1. Initial program 79.8%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6479.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified79.8%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6499.5%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr99.5%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Step-by-step derivation
          1. cos-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
          2. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
          4. fma-defineN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          10. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
          11. cos-lowering-cos.f6499.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
        8. Applied egg-rr99.8%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
        9. Step-by-step derivation
          1. sub-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          2. +-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          4. distribute-lft-neg-inN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          5. fma-defineN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          6. fma-lowering-fma.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          7. neg-sub0N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          8. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          10. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          11. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          12. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          13. cos-lowering-cos.f6499.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
        10. Applied egg-rr99.8%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
        11. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
        12. Step-by-step derivation
          1. sin-lowering-sin.f6498.6%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
        13. Simplified98.6%

          \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification89.2%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.4 \cdot 10^{-11}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{elif}\;\phi_1 \leq 10^{-47}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 21: 78.5% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \sin \phi_2\\ \mathbf{if}\;\lambda_1 \leq -1 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{elif}\;\lambda_1 \leq 0.0064:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \sin \phi_1 \cdot \left(\cos \lambda_2 \cdot \cos \phi_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\ \end{array} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0 (* (cos phi1) (sin phi2))))
         (if (<= lambda1 -1e-5)
           (atan2
            (* (sin lambda1) (cos phi2))
            (- t_0 (* (cos phi2) (* (sin phi1) (cos (- lambda1 lambda2))))))
           (if (<= lambda1 0.0064)
             (atan2
              (* (cos phi2) (sin (- lambda1 lambda2)))
              (- t_0 (* (sin phi1) (* (cos lambda2) (cos phi2)))))
             (atan2
              (*
               (cos phi2)
               (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
              (sin phi2))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = cos(phi1) * sin(phi2);
      	double tmp;
      	if (lambda1 <= -1e-5) {
      		tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
      	} else if (lambda1 <= 0.0064) {
      		tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(lambda2) * cos(phi2)))));
      	} else {
      		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2));
      	}
      	return tmp;
      }
      
      real(8) function code(lambda1, lambda2, phi1, phi2)
          real(8), intent (in) :: lambda1
          real(8), intent (in) :: lambda2
          real(8), intent (in) :: phi1
          real(8), intent (in) :: phi2
          real(8) :: t_0
          real(8) :: tmp
          t_0 = cos(phi1) * sin(phi2)
          if (lambda1 <= (-1d-5)) then
              tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))))
          else if (lambda1 <= 0.0064d0) then
              tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(lambda2) * cos(phi2)))))
          else
              tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2))
          end if
          code = tmp
      end function
      
      public static double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = Math.cos(phi1) * Math.sin(phi2);
      	double tmp;
      	if (lambda1 <= -1e-5) {
      		tmp = Math.atan2((Math.sin(lambda1) * Math.cos(phi2)), (t_0 - (Math.cos(phi2) * (Math.sin(phi1) * Math.cos((lambda1 - lambda2))))));
      	} else if (lambda1 <= 0.0064) {
      		tmp = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), (t_0 - (Math.sin(phi1) * (Math.cos(lambda2) * Math.cos(phi2)))));
      	} else {
      		tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.sin(lambda2) * Math.cos(lambda1)))), Math.sin(phi2));
      	}
      	return tmp;
      }
      
      def code(lambda1, lambda2, phi1, phi2):
      	t_0 = math.cos(phi1) * math.sin(phi2)
      	tmp = 0
      	if lambda1 <= -1e-5:
      		tmp = math.atan2((math.sin(lambda1) * math.cos(phi2)), (t_0 - (math.cos(phi2) * (math.sin(phi1) * math.cos((lambda1 - lambda2))))))
      	elif lambda1 <= 0.0064:
      		tmp = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), (t_0 - (math.sin(phi1) * (math.cos(lambda2) * math.cos(phi2)))))
      	else:
      		tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.sin(lambda2) * math.cos(lambda1)))), math.sin(phi2))
      	return tmp
      
      function code(lambda1, lambda2, phi1, phi2)
      	t_0 = Float64(cos(phi1) * sin(phi2))
      	tmp = 0.0
      	if (lambda1 <= -1e-5)
      		tmp = atan(Float64(sin(lambda1) * cos(phi2)), Float64(t_0 - Float64(cos(phi2) * Float64(sin(phi1) * cos(Float64(lambda1 - lambda2))))));
      	elseif (lambda1 <= 0.0064)
      		tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(t_0 - Float64(sin(phi1) * Float64(cos(lambda2) * cos(phi2)))));
      	else
      		tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), sin(phi2));
      	end
      	return tmp
      end
      
      function tmp_2 = code(lambda1, lambda2, phi1, phi2)
      	t_0 = cos(phi1) * sin(phi2);
      	tmp = 0.0;
      	if (lambda1 <= -1e-5)
      		tmp = atan2((sin(lambda1) * cos(phi2)), (t_0 - (cos(phi2) * (sin(phi1) * cos((lambda1 - lambda2))))));
      	elseif (lambda1 <= 0.0064)
      		tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), (t_0 - (sin(phi1) * (cos(lambda2) * cos(phi2)))));
      	else
      		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2));
      	end
      	tmp_2 = tmp;
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda1, -1e-5], N[ArcTan[N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda1, 0.0064], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(t$95$0 - N[(N[Sin[phi1], $MachinePrecision] * N[(N[Cos[lambda2], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \cos \phi_1 \cdot \sin \phi_2\\
      \mathbf{if}\;\lambda_1 \leq -1 \cdot 10^{-5}:\\
      \;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{t\_0 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\
      
      \mathbf{elif}\;\lambda_1 \leq 0.0064:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{t\_0 - \sin \phi_1 \cdot \left(\cos \lambda_2 \cdot \cos \phi_2\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if lambda1 < -1.00000000000000008e-5

        1. Initial program 66.7%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6466.7%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified66.7%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Taylor expanded in lambda2 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\color{blue}{\sin \lambda_1}, \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Step-by-step derivation
          1. sin-lowering-sin.f6467.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        7. Simplified67.0%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]

        if -1.00000000000000008e-5 < lambda1 < 0.00640000000000000031

        1. Initial program 99.0%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6499.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified99.0%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right)\right) \]
          2. associate-*r*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\cos \phi_2, \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \left(\lambda_1 - \lambda_2\right)\right), \sin \phi_1\right)\right)\right) \]
          6. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
          8. sin-lowering-sin.f6499.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        6. Applied egg-rr99.0%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \sin \phi_1}} \]
        7. Taylor expanded in lambda1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        8. Step-by-step derivation
          1. cos-negN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \cos \lambda_2\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
          2. cos-lowering-cos.f6499.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
        9. Simplified99.0%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\cos \phi_2 \cdot \color{blue}{\cos \lambda_2}\right) \cdot \sin \phi_1} \]

        if 0.00640000000000000031 < lambda1

        1. Initial program 48.7%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6448.7%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified48.7%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6479.8%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr79.8%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
        8. Step-by-step derivation
          1. sin-lowering-sin.f6459.3%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
        9. Simplified59.3%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification82.7%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\lambda_1 \leq -1 \cdot 10^{-5}:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1 \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\\ \mathbf{elif}\;\lambda_1 \leq 0.0064:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \left(\cos \lambda_2 \cdot \cos \phi_2\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 22: 78.3% accurate, 1.0× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \lambda_1 \cdot \cos \lambda_2\\ \mathbf{if}\;\lambda_2 \leq -8500000:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_0 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\ \mathbf{elif}\;\lambda_2 \leq 4.2 \cdot 10^{-13}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, t\_0\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \end{array} \end{array} \]
      (FPCore (lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0 (* (sin lambda1) (cos lambda2))))
         (if (<= lambda2 -8500000.0)
           (atan2 (* (cos phi2) (- t_0 (* (sin lambda2) (cos lambda1)))) (sin phi2))
           (if (<= lambda2 4.2e-13)
             (atan2
              (* (cos phi2) (sin (- lambda1 lambda2)))
              (-
               (* (cos phi1) (sin phi2))
               (* (cos phi2) (* (cos lambda1) (sin phi1)))))
             (atan2
              (* (fma (- 0.0 (sin lambda2)) (cos lambda1) t_0) (cos phi2))
              (sin phi2))))))
      double code(double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = sin(lambda1) * cos(lambda2);
      	double tmp;
      	if (lambda2 <= -8500000.0) {
      		tmp = atan2((cos(phi2) * (t_0 - (sin(lambda2) * cos(lambda1)))), sin(phi2));
      	} else if (lambda2 <= 4.2e-13) {
      		tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (cos(phi2) * (cos(lambda1) * sin(phi1)))));
      	} else {
      		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), t_0) * cos(phi2)), sin(phi2));
      	}
      	return tmp;
      }
      
      function code(lambda1, lambda2, phi1, phi2)
      	t_0 = Float64(sin(lambda1) * cos(lambda2))
      	tmp = 0.0
      	if (lambda2 <= -8500000.0)
      		tmp = atan(Float64(cos(phi2) * Float64(t_0 - Float64(sin(lambda2) * cos(lambda1)))), sin(phi2));
      	elseif (lambda2 <= 4.2e-13)
      		tmp = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(cos(phi2) * Float64(cos(lambda1) * sin(phi1)))));
      	else
      		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), t_0) * cos(phi2)), sin(phi2));
      	end
      	return tmp
      end
      
      code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[lambda2, -8500000.0], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$0 - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], If[LessEqual[lambda2, 4.2e-13], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[lambda1], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + t$95$0), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := \sin \lambda_1 \cdot \cos \lambda_2\\
      \mathbf{if}\;\lambda_2 \leq -8500000:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(t\_0 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\
      
      \mathbf{elif}\;\lambda_2 \leq 4.2 \cdot 10^{-13}:\\
      \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, t\_0\right) \cdot \cos \phi_2}{\sin \phi_2}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if lambda2 < -8.5e6

        1. Initial program 70.0%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6470.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified70.0%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. sin-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          4. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          8. sin-lowering-sin.f6484.4%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Applied egg-rr84.4%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        7. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
        8. Step-by-step derivation
          1. sin-lowering-sin.f6461.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
        9. Simplified61.0%

          \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]

        if -8.5e6 < lambda2 < 4.19999999999999977e-13

        1. Initial program 99.7%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6499.7%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified99.7%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Taylor expanded in lambda1 around inf

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\color{blue}{\lambda_1}\right)\right)\right)\right)\right) \]
        6. Step-by-step derivation
          1. Simplified99.7%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \color{blue}{\lambda_1}\right)} \]

          if 4.19999999999999977e-13 < lambda2

          1. Initial program 52.8%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6452.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified52.8%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. sin-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            4. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            7. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            8. sin-lowering-sin.f6480.6%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Applied egg-rr80.6%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          7. Step-by-step derivation
            1. cos-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
            2. +-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
            4. fma-defineN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
            5. fma-lowering-fma.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
            6. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
            7. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
            9. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
            10. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
            11. cos-lowering-cos.f6499.7%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          8. Applied egg-rr99.7%

            \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
          9. Step-by-step derivation
            1. sub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            2. +-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            4. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            5. fma-defineN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            6. fma-lowering-fma.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            7. neg-sub0N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            8. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            10. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            11. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            12. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            13. cos-lowering-cos.f6499.7%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          10. Applied egg-rr99.7%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
          11. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          12. Step-by-step derivation
            1. sin-lowering-sin.f6463.0%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          13. Simplified63.0%

            \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]
        7. Recombined 3 regimes into one program.
        8. Final simplification80.2%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\lambda_2 \leq -8500000:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\ \mathbf{elif}\;\lambda_2 \leq 4.2 \cdot 10^{-13}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\cos \lambda_1 \cdot \sin \phi_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \end{array} \]
        9. Add Preprocessing

        Alternative 23: 72.1% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \mathbf{if}\;\phi_1 \leq -3.6 \cdot 10^{-10}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\phi_1 \leq 3 \cdot 10^{-48}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0
                 (atan2
                  (* (cos phi2) (sin (- lambda1 lambda2)))
                  (-
                   (* (cos phi1) (sin phi2))
                   (* (sin phi1) (cos (- lambda1 lambda2)))))))
           (if (<= phi1 -3.6e-10)
             t_0
             (if (<= phi1 3e-48)
               (atan2
                (*
                 (fma
                  (- 0.0 (sin lambda2))
                  (cos lambda1)
                  (* (sin lambda1) (cos lambda2)))
                 (cos phi2))
                (sin phi2))
               t_0))))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
        	double tmp;
        	if (phi1 <= -3.6e-10) {
        		tmp = t_0;
        	} else if (phi1 <= 3e-48) {
        		tmp = atan2((fma((0.0 - sin(lambda2)), cos(lambda1), (sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        function code(lambda1, lambda2, phi1, phi2)
        	t_0 = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))))
        	tmp = 0.0
        	if (phi1 <= -3.6e-10)
        		tmp = t_0;
        	elseif (phi1 <= 3e-48)
        		tmp = atan(Float64(fma(Float64(0.0 - sin(lambda2)), cos(lambda1), Float64(sin(lambda1) * cos(lambda2))) * cos(phi2)), sin(phi2));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -3.6e-10], t$95$0, If[LessEqual[phi1, 3e-48], N[ArcTan[N[(N[(N[(0.0 - N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] * N[Cos[lambda1], $MachinePrecision] + N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
        \mathbf{if}\;\phi_1 \leq -3.6 \cdot 10^{-10}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;\phi_1 \leq 3 \cdot 10^{-48}:\\
        \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi1 < -3.6e-10 or 2.9999999999999999e-48 < phi1

          1. Initial program 80.4%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6480.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified80.5%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right) \]
          6. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
            2. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
            3. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \sin \phi_1\right)\right)\right) \]
            4. sin-lowering-sin.f6453.7%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
          7. Simplified53.7%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}} \]

          if -3.6e-10 < phi1 < 2.9999999999999999e-48

          1. Initial program 79.8%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6479.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified79.8%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. sin-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            4. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            7. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            8. sin-lowering-sin.f6499.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Applied egg-rr99.5%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          7. Step-by-step derivation
            1. cos-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2 + \color{blue}{\sin \lambda_1 \cdot \sin \lambda_2}\right)\right)\right)\right)\right) \]
            2. +-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_1 \cdot \sin \lambda_2 + \color{blue}{\cos \lambda_1 \cdot \cos \lambda_2}\right)\right)\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\sin \lambda_2 \cdot \sin \lambda_1 + \color{blue}{\cos \lambda_1} \cdot \cos \lambda_2\right)\right)\right)\right)\right) \]
            4. fma-defineN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \left(\mathsf{fma}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
            5. fma-lowering-fma.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\sin \lambda_2, \color{blue}{\sin \lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
            6. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \sin \color{blue}{\lambda_1}, \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
            7. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_1 \cdot \cos \lambda_2\right)\right)\right)\right)\right)\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \left(\cos \lambda_2 \cdot \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
            9. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\cos \lambda_2, \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
            10. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \cos \lambda_1\right)\right)\right)\right)\right)\right) \]
            11. cos-lowering-cos.f6499.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          8. Applied egg-rr99.8%

            \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)}\right)} \]
          9. Step-by-step derivation
            1. sub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 + \left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            2. +-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2 \cdot \cos \lambda_1\right)\right) + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            4. distribute-lft-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right) \cdot \cos \lambda_1 + \sin \lambda_1 \cdot \cos \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            5. fma-defineN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\mathsf{fma}\left(\mathsf{neg}\left(\sin \lambda_2\right), \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            6. fma-lowering-fma.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(\mathsf{neg}\left(\sin \lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            7. neg-sub0N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\left(0 - \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            8. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \sin \lambda_2\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \cos \lambda_1, \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            10. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \left(\sin \lambda_1 \cdot \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            11. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            12. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
            13. cos-lowering-cos.f6499.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{fma.f64}\left(\mathsf{sin.f64}\left(\lambda_2\right), \mathsf{sin.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{cos.f64}\left(\lambda_1\right)\right)\right)\right)\right)\right)\right) \]
          10. Applied egg-rr99.8%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \mathsf{fma}\left(\sin \lambda_2, \sin \lambda_1, \cos \lambda_2 \cdot \cos \lambda_1\right)\right)} \]
          11. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          12. Step-by-step derivation
            1. sin-lowering-sin.f6498.6%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{fma.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\lambda_2\right)\right), \mathsf{cos.f64}\left(\lambda_1\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          13. Simplified98.6%

            \[\leadsto \tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification75.3%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -3.6 \cdot 10^{-10}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \mathbf{elif}\;\phi_1 \leq 3 \cdot 10^{-48}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{fma}\left(0 - \sin \lambda_2, \cos \lambda_1, \sin \lambda_1 \cdot \cos \lambda_2\right) \cdot \cos \phi_2}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 24: 72.1% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \mathbf{if}\;\phi_1 \leq -1.6 \cdot 10^{-8}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\phi_1 \leq 2.1 \cdot 10^{-47}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0
                 (atan2
                  (* (cos phi2) (sin (- lambda1 lambda2)))
                  (-
                   (* (cos phi1) (sin phi2))
                   (* (sin phi1) (cos (- lambda1 lambda2)))))))
           (if (<= phi1 -1.6e-8)
             t_0
             (if (<= phi1 2.1e-47)
               (atan2
                (*
                 (cos phi2)
                 (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
                (sin phi2))
               t_0))))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
        	double tmp;
        	if (phi1 <= -1.6e-8) {
        		tmp = t_0;
        	} else if (phi1 <= 2.1e-47) {
        		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8) :: t_0
            real(8) :: tmp
            t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))))
            if (phi1 <= (-1.6d-8)) then
                tmp = t_0
            else if (phi1 <= 2.1d-47) then
                tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2))
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda1 - lambda2)))));
        	double tmp;
        	if (phi1 <= -1.6e-8) {
        		tmp = t_0;
        	} else if (phi1 <= 2.1e-47) {
        		tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.sin(lambda2) * Math.cos(lambda1)))), Math.sin(phi2));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	t_0 = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda1 - lambda2)))))
        	tmp = 0
        	if phi1 <= -1.6e-8:
        		tmp = t_0
        	elif phi1 <= 2.1e-47:
        		tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.sin(lambda2) * math.cos(lambda1)))), math.sin(phi2))
        	else:
        		tmp = t_0
        	return tmp
        
        function code(lambda1, lambda2, phi1, phi2)
        	t_0 = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda1 - lambda2)))))
        	tmp = 0.0
        	if (phi1 <= -1.6e-8)
        		tmp = t_0;
        	elseif (phi1 <= 2.1e-47)
        		tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), sin(phi2));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(lambda1, lambda2, phi1, phi2)
        	t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda1 - lambda2)))));
        	tmp = 0.0;
        	if (phi1 <= -1.6e-8)
        		tmp = t_0;
        	elseif (phi1 <= 2.1e-47)
        		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2));
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -1.6e-8], t$95$0, If[LessEqual[phi1, 2.1e-47], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\
        \mathbf{if}\;\phi_1 \leq -1.6 \cdot 10^{-8}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;\phi_1 \leq 2.1 \cdot 10^{-47}:\\
        \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi1 < -1.6000000000000001e-8 or 2.1000000000000001e-47 < phi1

          1. Initial program 80.4%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6480.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified80.5%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right) \]
          6. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
            2. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
            3. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \sin \phi_1\right)\right)\right) \]
            4. sin-lowering-sin.f6453.7%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
          7. Simplified53.7%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1}} \]

          if -1.6000000000000001e-8 < phi1 < 2.1000000000000001e-47

          1. Initial program 79.8%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6479.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified79.8%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. sin-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            4. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            7. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            8. sin-lowering-sin.f6499.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Applied egg-rr99.5%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          7. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          8. Step-by-step derivation
            1. sin-lowering-sin.f6498.6%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          9. Simplified98.6%

            \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification75.3%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -1.6 \cdot 10^{-8}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \mathbf{elif}\;\phi_1 \leq 2.1 \cdot 10^{-47}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 25: 70.9% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\left(0 - \sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{if}\;\phi_1 \leq -8 \cdot 10^{-8}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\phi_1 \leq 5.6 \cdot 10^{-6}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0
                 (atan2
                  (* (cos phi2) (sin (- lambda1 lambda2)))
                  (* (- 0.0 (sin phi1)) (cos (- lambda2 lambda1))))))
           (if (<= phi1 -8e-8)
             t_0
             (if (<= phi1 5.6e-6)
               (atan2
                (*
                 (cos phi2)
                 (- (* (sin lambda1) (cos lambda2)) (* (sin lambda2) (cos lambda1))))
                (sin phi2))
               t_0))))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((0.0 - sin(phi1)) * cos((lambda2 - lambda1))));
        	double tmp;
        	if (phi1 <= -8e-8) {
        		tmp = t_0;
        	} else if (phi1 <= 5.6e-6) {
        		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8) :: t_0
            real(8) :: tmp
            t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((0.0d0 - sin(phi1)) * cos((lambda2 - lambda1))))
            if (phi1 <= (-8d-8)) then
                tmp = t_0
            else if (phi1 <= 5.6d-6) then
                tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2))
            else
                tmp = t_0
            end if
            code = tmp
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), ((0.0 - Math.sin(phi1)) * Math.cos((lambda2 - lambda1))));
        	double tmp;
        	if (phi1 <= -8e-8) {
        		tmp = t_0;
        	} else if (phi1 <= 5.6e-6) {
        		tmp = Math.atan2((Math.cos(phi2) * ((Math.sin(lambda1) * Math.cos(lambda2)) - (Math.sin(lambda2) * Math.cos(lambda1)))), Math.sin(phi2));
        	} else {
        		tmp = t_0;
        	}
        	return tmp;
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	t_0 = math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), ((0.0 - math.sin(phi1)) * math.cos((lambda2 - lambda1))))
        	tmp = 0
        	if phi1 <= -8e-8:
        		tmp = t_0
        	elif phi1 <= 5.6e-6:
        		tmp = math.atan2((math.cos(phi2) * ((math.sin(lambda1) * math.cos(lambda2)) - (math.sin(lambda2) * math.cos(lambda1)))), math.sin(phi2))
        	else:
        		tmp = t_0
        	return tmp
        
        function code(lambda1, lambda2, phi1, phi2)
        	t_0 = atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), Float64(Float64(0.0 - sin(phi1)) * cos(Float64(lambda2 - lambda1))))
        	tmp = 0.0
        	if (phi1 <= -8e-8)
        		tmp = t_0;
        	elseif (phi1 <= 5.6e-6)
        		tmp = atan(Float64(cos(phi2) * Float64(Float64(sin(lambda1) * cos(lambda2)) - Float64(sin(lambda2) * cos(lambda1)))), sin(phi2));
        	else
        		tmp = t_0;
        	end
        	return tmp
        end
        
        function tmp_2 = code(lambda1, lambda2, phi1, phi2)
        	t_0 = atan2((cos(phi2) * sin((lambda1 - lambda2))), ((0.0 - sin(phi1)) * cos((lambda2 - lambda1))));
        	tmp = 0.0;
        	if (phi1 <= -8e-8)
        		tmp = t_0;
        	elseif (phi1 <= 5.6e-6)
        		tmp = atan2((cos(phi2) * ((sin(lambda1) * cos(lambda2)) - (sin(lambda2) * cos(lambda1)))), sin(phi2));
        	else
        		tmp = t_0;
        	end
        	tmp_2 = tmp;
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[(N[(0.0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -8e-8], t$95$0, If[LessEqual[phi1, 5.6e-6], N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[lambda2], $MachinePrecision] * N[Cos[lambda1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision], t$95$0]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\left(0 - \sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
        \mathbf{if}\;\phi_1 \leq -8 \cdot 10^{-8}:\\
        \;\;\;\;t\_0\\
        
        \mathbf{elif}\;\phi_1 \leq 5.6 \cdot 10^{-6}:\\
        \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_0\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi1 < -8.0000000000000002e-8 or 5.59999999999999975e-6 < phi1

          1. Initial program 79.8%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6479.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified79.8%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. associate-*r*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            2. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)}\right)\right)\right) \]
            4. cos-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            5. flip-+N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            6. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_2 \cdot \cos \lambda_1 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            7. fmm-defN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            9. sin-cos-multN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}{\color{blue}{2}}\right)\right)\right) \]
            10. clear-numN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{1}{\color{blue}{\frac{2}{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}}}\right)\right)\right) \]
          6. Applied egg-rr79.8%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\frac{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\lambda_1 + \lambda_2\right)\right) \cdot 1}{\cos \left(\lambda_1 + \lambda_2\right) \cdot \frac{1}{\cos \phi_2 \cdot \sin \phi_1}}}} \]
          7. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\left(-1 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)\right)}\right) \]
          8. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\mathsf{neg}\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)\right)\right) \]
            2. distribute-rgt-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin \phi_1\right)\right)}\right)\right) \]
            3. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(-1 \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(-1 \cdot \sin \phi_1\right)}\right)\right) \]
            5. sub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            6. remove-double-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            7. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(-1 \cdot \lambda_1\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            8. distribute-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(-1 \cdot \lambda_1 + \lambda_2\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            9. +-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            10. cos-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_2 + -1 \cdot \lambda_1\right), \left(\color{blue}{-1} \cdot \sin \phi_1\right)\right)\right) \]
            11. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right), \left(\color{blue}{-1} \cdot \sin \phi_1\right)\right)\right) \]
            12. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + \left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            13. unsub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 - \lambda_1\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            14. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            15. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \mathsf{*.f64}\left(-1, \color{blue}{\sin \phi_1}\right)\right)\right) \]
            16. sin-lowering-sin.f6449.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \mathsf{*.f64}\left(-1, \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
          9. Simplified49.5%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\cos \left(\lambda_2 - \lambda_1\right) \cdot \left(-1 \cdot \sin \phi_1\right)}} \]

          if -8.0000000000000002e-8 < phi1 < 5.59999999999999975e-6

          1. Initial program 80.5%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6480.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified80.5%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. sin-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\sin \lambda_1 \cdot \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\sin \lambda_1, \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\color{blue}{\phi_1}\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            4. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \cos \lambda_2\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \left(\cos \lambda_1 \cdot \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            6. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_1, \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            7. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \sin \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            8. sin-lowering-sin.f6499.2%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Applied egg-rr99.2%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right)} \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          7. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          8. Step-by-step derivation
            1. sin-lowering-sin.f6497.6%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_1\right), \mathsf{sin.f64}\left(\lambda_2\right)\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          9. Simplified97.6%

            \[\leadsto \tan^{-1}_* \frac{\left(\sin \lambda_1 \cdot \cos \lambda_2 - \cos \lambda_1 \cdot \sin \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification74.3%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -8 \cdot 10^{-8}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\left(0 - \sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{elif}\;\phi_1 \leq 5.6 \cdot 10^{-6}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \left(\sin \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_2 \cdot \cos \lambda_1\right)}{\sin \phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\left(0 - \sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 26: 63.9% accurate, 1.3× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\ t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\ \mathbf{if}\;\phi_2 \leq -0.0114:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\phi_2 \leq 2.1:\\ \;\;\;\;\tan^{-1}_* \frac{t\_0}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0 (sin (- lambda1 lambda2)))
                (t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
           (if (<= phi2 -0.0114)
             t_1
             (if (<= phi2 2.1)
               (atan2
                t_0
                (- (* (cos phi1) (sin phi2)) (* (sin phi1) (cos (- lambda2 lambda1)))))
               t_1))))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = sin((lambda1 - lambda2));
        	double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
        	double tmp;
        	if (phi2 <= -0.0114) {
        		tmp = t_1;
        	} else if (phi2 <= 2.1) {
        		tmp = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda2 - lambda1)))));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8) :: t_0
            real(8) :: t_1
            real(8) :: tmp
            t_0 = sin((lambda1 - lambda2))
            t_1 = atan2((cos(phi2) * t_0), sin(phi2))
            if (phi2 <= (-0.0114d0)) then
                tmp = t_1
            else if (phi2 <= 2.1d0) then
                tmp = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda2 - lambda1)))))
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = Math.sin((lambda1 - lambda2));
        	double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
        	double tmp;
        	if (phi2 <= -0.0114) {
        		tmp = t_1;
        	} else if (phi2 <= 2.1) {
        		tmp = Math.atan2(t_0, ((Math.cos(phi1) * Math.sin(phi2)) - (Math.sin(phi1) * Math.cos((lambda2 - lambda1)))));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	t_0 = math.sin((lambda1 - lambda2))
        	t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2))
        	tmp = 0
        	if phi2 <= -0.0114:
        		tmp = t_1
        	elif phi2 <= 2.1:
        		tmp = math.atan2(t_0, ((math.cos(phi1) * math.sin(phi2)) - (math.sin(phi1) * math.cos((lambda2 - lambda1)))))
        	else:
        		tmp = t_1
        	return tmp
        
        function code(lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(lambda1 - lambda2))
        	t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2))
        	tmp = 0.0
        	if (phi2 <= -0.0114)
        		tmp = t_1;
        	elseif (phi2 <= 2.1)
        		tmp = atan(t_0, Float64(Float64(cos(phi1) * sin(phi2)) - Float64(sin(phi1) * cos(Float64(lambda2 - lambda1)))));
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(lambda1, lambda2, phi1, phi2)
        	t_0 = sin((lambda1 - lambda2));
        	t_1 = atan2((cos(phi2) * t_0), sin(phi2));
        	tmp = 0.0;
        	if (phi2 <= -0.0114)
        		tmp = t_1;
        	elseif (phi2 <= 2.1)
        		tmp = atan2(t_0, ((cos(phi1) * sin(phi2)) - (sin(phi1) * cos((lambda2 - lambda1)))));
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.0114], t$95$1, If[LessEqual[phi2, 2.1], N[ArcTan[t$95$0 / N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[phi2], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
        t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
        \mathbf{if}\;\phi_2 \leq -0.0114:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;\phi_2 \leq 2.1:\\
        \;\;\;\;\tan^{-1}_* \frac{t\_0}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi2 < -0.0114 or 2.10000000000000009 < phi2

          1. Initial program 78.6%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6478.6%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified78.6%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. associate-*r*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            2. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)}\right)\right)\right) \]
            4. cos-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            5. flip-+N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            6. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_2 \cdot \cos \lambda_1 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            7. fmm-defN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            9. sin-cos-multN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}{\color{blue}{2}}\right)\right)\right) \]
            10. clear-numN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{1}{\color{blue}{\frac{2}{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}}}\right)\right)\right) \]
          6. Applied egg-rr78.6%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\frac{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\lambda_1 + \lambda_2\right)\right) \cdot 1}{\cos \left(\lambda_1 + \lambda_2\right) \cdot \frac{1}{\cos \phi_2 \cdot \sin \phi_1}}}} \]
          7. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          8. Step-by-step derivation
            1. sin-lowering-sin.f6452.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          9. Simplified52.5%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]

          if -0.0114 < phi2 < 2.10000000000000009

          1. Initial program 82.1%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6482.1%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified82.1%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f6482.3%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. Simplified82.3%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          8. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right) \]
          9. Step-by-step derivation
            1. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
            2. sub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            3. remove-double-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            4. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(-1 \cdot \lambda_1\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            5. distribute-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(-1 \cdot \lambda_1 + \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            6. +-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            7. cos-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_2 + -1 \cdot \lambda_1\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
            9. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + \left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            10. unsub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 - \lambda_1\right)\right), \sin \phi_1\right)\right)\right) \]
            11. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \sin \phi_1\right)\right)\right) \]
            12. sin-lowering-sin.f6482.4%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
          10. Simplified82.4%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\cos \left(\lambda_2 - \lambda_1\right) \cdot \sin \phi_1}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification65.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -0.0114:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\ \mathbf{elif}\;\phi_2 \leq 2.1:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 27: 63.9% accurate, 1.6× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\ t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\ \mathbf{if}\;\phi_2 \leq -0.00152:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\phi_2 \leq 2.1:\\ \;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0 (sin (- lambda1 lambda2)))
                (t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
           (if (<= phi2 -0.00152)
             t_1
             (if (<= phi2 2.1)
               (atan2
                t_0
                (- (* phi2 (cos phi1)) (* (sin phi1) (cos (- lambda2 lambda1)))))
               t_1))))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = sin((lambda1 - lambda2));
        	double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
        	double tmp;
        	if (phi2 <= -0.00152) {
        		tmp = t_1;
        	} else if (phi2 <= 2.1) {
        		tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda2 - lambda1)))));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8) :: t_0
            real(8) :: t_1
            real(8) :: tmp
            t_0 = sin((lambda1 - lambda2))
            t_1 = atan2((cos(phi2) * t_0), sin(phi2))
            if (phi2 <= (-0.00152d0)) then
                tmp = t_1
            else if (phi2 <= 2.1d0) then
                tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda2 - lambda1)))))
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = Math.sin((lambda1 - lambda2));
        	double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
        	double tmp;
        	if (phi2 <= -0.00152) {
        		tmp = t_1;
        	} else if (phi2 <= 2.1) {
        		tmp = Math.atan2(t_0, ((phi2 * Math.cos(phi1)) - (Math.sin(phi1) * Math.cos((lambda2 - lambda1)))));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	t_0 = math.sin((lambda1 - lambda2))
        	t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2))
        	tmp = 0
        	if phi2 <= -0.00152:
        		tmp = t_1
        	elif phi2 <= 2.1:
        		tmp = math.atan2(t_0, ((phi2 * math.cos(phi1)) - (math.sin(phi1) * math.cos((lambda2 - lambda1)))))
        	else:
        		tmp = t_1
        	return tmp
        
        function code(lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(lambda1 - lambda2))
        	t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2))
        	tmp = 0.0
        	if (phi2 <= -0.00152)
        		tmp = t_1;
        	elseif (phi2 <= 2.1)
        		tmp = atan(t_0, Float64(Float64(phi2 * cos(phi1)) - Float64(sin(phi1) * cos(Float64(lambda2 - lambda1)))));
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(lambda1, lambda2, phi1, phi2)
        	t_0 = sin((lambda1 - lambda2));
        	t_1 = atan2((cos(phi2) * t_0), sin(phi2));
        	tmp = 0.0;
        	if (phi2 <= -0.00152)
        		tmp = t_1;
        	elseif (phi2 <= 2.1)
        		tmp = atan2(t_0, ((phi2 * cos(phi1)) - (sin(phi1) * cos((lambda2 - lambda1)))));
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -0.00152], t$95$1, If[LessEqual[phi2, 2.1], N[ArcTan[t$95$0 / N[(N[(phi2 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
        t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
        \mathbf{if}\;\phi_2 \leq -0.00152:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;\phi_2 \leq 2.1:\\
        \;\;\;\;\tan^{-1}_* \frac{t\_0}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi2 < -0.0015200000000000001 or 2.10000000000000009 < phi2

          1. Initial program 78.6%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6478.6%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified78.6%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. associate-*r*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            2. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)}\right)\right)\right) \]
            4. cos-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            5. flip-+N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            6. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_2 \cdot \cos \lambda_1 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            7. fmm-defN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            9. sin-cos-multN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}{\color{blue}{2}}\right)\right)\right) \]
            10. clear-numN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{1}{\color{blue}{\frac{2}{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}}}\right)\right)\right) \]
          6. Applied egg-rr78.6%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\frac{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\lambda_1 + \lambda_2\right)\right) \cdot 1}{\cos \left(\lambda_1 + \lambda_2\right) \cdot \frac{1}{\cos \phi_2 \cdot \sin \phi_1}}}} \]
          7. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          8. Step-by-step derivation
            1. sin-lowering-sin.f6452.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          9. Simplified52.5%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]

          if -0.0015200000000000001 < phi2 < 2.10000000000000009

          1. Initial program 82.1%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6482.1%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified82.1%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f6482.3%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. Simplified82.3%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          8. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\left(\phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right) \]
          9. Step-by-step derivation
            1. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\left(\phi_2 \cdot \cos \phi_1\right), \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \cos \phi_1\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right) \]
            3. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \phi_1}\right)\right)\right) \]
            5. sub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            6. remove-double-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            7. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(-1 \cdot \lambda_1\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            8. distribute-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(-1 \cdot \lambda_1 + \lambda_2\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            9. +-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            10. cos-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_2 + -1 \cdot \lambda_1\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
            11. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right), \sin \color{blue}{\phi_1}\right)\right)\right) \]
            12. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + \left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right), \sin \phi_1\right)\right)\right) \]
            13. unsub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 - \lambda_1\right)\right), \sin \phi_1\right)\right)\right) \]
            14. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \sin \phi_1\right)\right)\right) \]
            15. sin-lowering-sin.f6482.3%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\phi_2, \mathsf{cos.f64}\left(\phi_1\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
          10. Simplified82.3%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\phi_2 \cdot \cos \phi_1 - \cos \left(\lambda_2 - \lambda_1\right) \cdot \sin \phi_1}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification65.8%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -0.00152:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\ \mathbf{elif}\;\phi_2 \leq 2.1:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2 \cdot \cos \phi_1 - \sin \phi_1 \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 28: 61.6% accurate, 1.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\ t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\ \mathbf{if}\;\phi_2 \leq -3.7 \cdot 10^{-7}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\phi_2 \leq 2.9 \cdot 10^{-57}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_0}{\left(0 - \sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0 (sin (- lambda1 lambda2)))
                (t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
           (if (<= phi2 -3.7e-7)
             t_1
             (if (<= phi2 2.9e-57)
               (atan2 t_0 (* (- 0.0 (sin phi1)) (cos (- lambda2 lambda1))))
               t_1))))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = sin((lambda1 - lambda2));
        	double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
        	double tmp;
        	if (phi2 <= -3.7e-7) {
        		tmp = t_1;
        	} else if (phi2 <= 2.9e-57) {
        		tmp = atan2(t_0, ((0.0 - sin(phi1)) * cos((lambda2 - lambda1))));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8) :: t_0
            real(8) :: t_1
            real(8) :: tmp
            t_0 = sin((lambda1 - lambda2))
            t_1 = atan2((cos(phi2) * t_0), sin(phi2))
            if (phi2 <= (-3.7d-7)) then
                tmp = t_1
            else if (phi2 <= 2.9d-57) then
                tmp = atan2(t_0, ((0.0d0 - sin(phi1)) * cos((lambda2 - lambda1))))
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = Math.sin((lambda1 - lambda2));
        	double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
        	double tmp;
        	if (phi2 <= -3.7e-7) {
        		tmp = t_1;
        	} else if (phi2 <= 2.9e-57) {
        		tmp = Math.atan2(t_0, ((0.0 - Math.sin(phi1)) * Math.cos((lambda2 - lambda1))));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	t_0 = math.sin((lambda1 - lambda2))
        	t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2))
        	tmp = 0
        	if phi2 <= -3.7e-7:
        		tmp = t_1
        	elif phi2 <= 2.9e-57:
        		tmp = math.atan2(t_0, ((0.0 - math.sin(phi1)) * math.cos((lambda2 - lambda1))))
        	else:
        		tmp = t_1
        	return tmp
        
        function code(lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(lambda1 - lambda2))
        	t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2))
        	tmp = 0.0
        	if (phi2 <= -3.7e-7)
        		tmp = t_1;
        	elseif (phi2 <= 2.9e-57)
        		tmp = atan(t_0, Float64(Float64(0.0 - sin(phi1)) * cos(Float64(lambda2 - lambda1))));
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(lambda1, lambda2, phi1, phi2)
        	t_0 = sin((lambda1 - lambda2));
        	t_1 = atan2((cos(phi2) * t_0), sin(phi2));
        	tmp = 0.0;
        	if (phi2 <= -3.7e-7)
        		tmp = t_1;
        	elseif (phi2 <= 2.9e-57)
        		tmp = atan2(t_0, ((0.0 - sin(phi1)) * cos((lambda2 - lambda1))));
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -3.7e-7], t$95$1, If[LessEqual[phi2, 2.9e-57], N[ArcTan[t$95$0 / N[(N[(0.0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
        t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
        \mathbf{if}\;\phi_2 \leq -3.7 \cdot 10^{-7}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;\phi_2 \leq 2.9 \cdot 10^{-57}:\\
        \;\;\;\;\tan^{-1}_* \frac{t\_0}{\left(0 - \sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi2 < -3.70000000000000004e-7 or 2.90000000000000025e-57 < phi2

          1. Initial program 79.1%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6479.1%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified79.1%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. associate-*r*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            2. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)}\right)\right)\right) \]
            4. cos-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            5. flip-+N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            6. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_2 \cdot \cos \lambda_1 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            7. fmm-defN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            9. sin-cos-multN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}{\color{blue}{2}}\right)\right)\right) \]
            10. clear-numN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{1}{\color{blue}{\frac{2}{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}}}\right)\right)\right) \]
          6. Applied egg-rr79.1%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\frac{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\lambda_1 + \lambda_2\right)\right) \cdot 1}{\cos \left(\lambda_1 + \lambda_2\right) \cdot \frac{1}{\cos \phi_2 \cdot \sin \phi_1}}}} \]
          7. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          8. Step-by-step derivation
            1. sin-lowering-sin.f6452.5%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          9. Simplified52.5%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]

          if -3.70000000000000004e-7 < phi2 < 2.90000000000000025e-57

          1. Initial program 81.8%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6481.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified81.8%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f6481.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. Simplified81.8%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          8. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\left(-1 \cdot \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)\right)}\right) \]
          9. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)\right)\right) \]
            2. distribute-rgt-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\mathsf{neg}\left(\sin \phi_1\right)\right)}\right)\right) \]
            3. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \left(-1 \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\left(-1 \cdot \sin \phi_1\right)}\right)\right) \]
            5. sub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_1 + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            6. remove-double-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(\left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            7. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\cos \left(\left(\mathsf{neg}\left(-1 \cdot \lambda_1\right)\right) + \left(\mathsf{neg}\left(\lambda_2\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            8. distribute-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(-1 \cdot \lambda_1 + \lambda_2\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            9. +-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            10. cos-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\cos \left(\lambda_2 + -1 \cdot \lambda_1\right), \left(\color{blue}{-1} \cdot \sin \phi_1\right)\right)\right) \]
            11. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + -1 \cdot \lambda_1\right)\right), \left(\color{blue}{-1} \cdot \sin \phi_1\right)\right)\right) \]
            12. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 + \left(\mathsf{neg}\left(\lambda_1\right)\right)\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            13. unsub-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\left(\lambda_2 - \lambda_1\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            14. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \left(-1 \cdot \sin \phi_1\right)\right)\right) \]
            15. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \mathsf{*.f64}\left(-1, \color{blue}{\sin \phi_1}\right)\right)\right) \]
            16. sin-lowering-sin.f6479.1%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_2, \lambda_1\right)\right), \mathsf{*.f64}\left(-1, \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
          10. Simplified79.1%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\cos \left(\lambda_2 - \lambda_1\right) \cdot \left(-1 \cdot \sin \phi_1\right)}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification63.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -3.7 \cdot 10^{-7}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\ \mathbf{elif}\;\phi_2 \leq 2.9 \cdot 10^{-57}:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\left(0 - \sin \phi_1\right) \cdot \cos \left(\lambda_2 - \lambda_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 29: 57.3% accurate, 2.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\ t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\ \mathbf{if}\;\phi_2 \leq -1.85 \cdot 10^{-16}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\phi_2 \leq 2.9 \cdot 10^{-57}:\\ \;\;\;\;\tan^{-1}_* \frac{t\_0}{\cos \lambda_2 \cdot \left(0 - \sin \phi_1\right)}\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0 (sin (- lambda1 lambda2)))
                (t_1 (atan2 (* (cos phi2) t_0) (sin phi2))))
           (if (<= phi2 -1.85e-16)
             t_1
             (if (<= phi2 2.9e-57)
               (atan2 t_0 (* (cos lambda2) (- 0.0 (sin phi1))))
               t_1))))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = sin((lambda1 - lambda2));
        	double t_1 = atan2((cos(phi2) * t_0), sin(phi2));
        	double tmp;
        	if (phi2 <= -1.85e-16) {
        		tmp = t_1;
        	} else if (phi2 <= 2.9e-57) {
        		tmp = atan2(t_0, (cos(lambda2) * (0.0 - sin(phi1))));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8) :: t_0
            real(8) :: t_1
            real(8) :: tmp
            t_0 = sin((lambda1 - lambda2))
            t_1 = atan2((cos(phi2) * t_0), sin(phi2))
            if (phi2 <= (-1.85d-16)) then
                tmp = t_1
            else if (phi2 <= 2.9d-57) then
                tmp = atan2(t_0, (cos(lambda2) * (0.0d0 - sin(phi1))))
            else
                tmp = t_1
            end if
            code = tmp
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = Math.sin((lambda1 - lambda2));
        	double t_1 = Math.atan2((Math.cos(phi2) * t_0), Math.sin(phi2));
        	double tmp;
        	if (phi2 <= -1.85e-16) {
        		tmp = t_1;
        	} else if (phi2 <= 2.9e-57) {
        		tmp = Math.atan2(t_0, (Math.cos(lambda2) * (0.0 - Math.sin(phi1))));
        	} else {
        		tmp = t_1;
        	}
        	return tmp;
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	t_0 = math.sin((lambda1 - lambda2))
        	t_1 = math.atan2((math.cos(phi2) * t_0), math.sin(phi2))
        	tmp = 0
        	if phi2 <= -1.85e-16:
        		tmp = t_1
        	elif phi2 <= 2.9e-57:
        		tmp = math.atan2(t_0, (math.cos(lambda2) * (0.0 - math.sin(phi1))))
        	else:
        		tmp = t_1
        	return tmp
        
        function code(lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(lambda1 - lambda2))
        	t_1 = atan(Float64(cos(phi2) * t_0), sin(phi2))
        	tmp = 0.0
        	if (phi2 <= -1.85e-16)
        		tmp = t_1;
        	elseif (phi2 <= 2.9e-57)
        		tmp = atan(t_0, Float64(cos(lambda2) * Float64(0.0 - sin(phi1))));
        	else
        		tmp = t_1;
        	end
        	return tmp
        end
        
        function tmp_2 = code(lambda1, lambda2, phi1, phi2)
        	t_0 = sin((lambda1 - lambda2));
        	t_1 = atan2((cos(phi2) * t_0), sin(phi2));
        	tmp = 0.0;
        	if (phi2 <= -1.85e-16)
        		tmp = t_1;
        	elseif (phi2 <= 2.9e-57)
        		tmp = atan2(t_0, (cos(lambda2) * (0.0 - sin(phi1))));
        	else
        		tmp = t_1;
        	end
        	tmp_2 = tmp;
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * t$95$0), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi2, -1.85e-16], t$95$1, If[LessEqual[phi2, 2.9e-57], N[ArcTan[t$95$0 / N[(N[Cos[lambda2], $MachinePrecision] * N[(0.0 - N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$1]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := \sin \left(\lambda_1 - \lambda_2\right)\\
        t_1 := \tan^{-1}_* \frac{\cos \phi_2 \cdot t\_0}{\sin \phi_2}\\
        \mathbf{if}\;\phi_2 \leq -1.85 \cdot 10^{-16}:\\
        \;\;\;\;t\_1\\
        
        \mathbf{elif}\;\phi_2 \leq 2.9 \cdot 10^{-57}:\\
        \;\;\;\;\tan^{-1}_* \frac{t\_0}{\cos \lambda_2 \cdot \left(0 - \sin \phi_1\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;t\_1\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi2 < -1.85e-16 or 2.90000000000000025e-57 < phi2

          1. Initial program 78.7%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6478.8%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified78.8%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Step-by-step derivation
            1. associate-*r*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            2. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
            3. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)}\right)\right)\right) \]
            4. cos-diffN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            5. flip-+N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
            6. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_2 \cdot \cos \lambda_1 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            7. fmm-defN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            8. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
            9. sin-cos-multN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}{\color{blue}{2}}\right)\right)\right) \]
            10. clear-numN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{1}{\color{blue}{\frac{2}{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}}}\right)\right)\right) \]
          6. Applied egg-rr78.7%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\frac{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\lambda_1 + \lambda_2\right)\right) \cdot 1}{\cos \left(\lambda_1 + \lambda_2\right) \cdot \frac{1}{\cos \phi_2 \cdot \sin \phi_1}}}} \]
          7. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          8. Step-by-step derivation
            1. sin-lowering-sin.f6452.0%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          9. Simplified52.0%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]

          if -1.85e-16 < phi2 < 2.90000000000000025e-57

          1. Initial program 82.4%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6482.4%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified82.4%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f6482.4%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. Simplified82.4%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          8. Taylor expanded in lambda1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \color{blue}{\cos \left(\mathsf{neg}\left(\lambda_2\right)\right)}\right)\right)\right)\right) \]
          9. Step-by-step derivation
            1. cos-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \lambda_2\right)\right)\right)\right) \]
            2. cos-lowering-cos.f6473.0%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\lambda_2\right)\right)\right)\right)\right) \]
          10. Simplified73.0%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \color{blue}{\cos \lambda_2}\right)} \]
          11. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\left(-1 \cdot \left(\cos \lambda_2 \cdot \sin \phi_1\right)\right)}\right) \]
          12. Step-by-step derivation
            1. mul-1-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\mathsf{neg}\left(\cos \lambda_2 \cdot \sin \phi_1\right)\right)\right) \]
            2. distribute-rgt-neg-inN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\cos \lambda_2 \cdot \color{blue}{\left(\mathsf{neg}\left(\sin \phi_1\right)\right)}\right)\right) \]
            3. sin-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \left(\cos \lambda_2 \cdot \sin \left(\mathsf{neg}\left(\phi_1\right)\right)\right)\right) \]
            4. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\cos \lambda_2, \color{blue}{\sin \left(\mathsf{neg}\left(\phi_1\right)\right)}\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \sin \color{blue}{\left(\mathsf{neg}\left(\phi_1\right)\right)}\right)\right) \]
            6. sin-negN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \left(\mathsf{neg}\left(\sin \phi_1\right)\right)\right)\right) \]
            7. neg-sub0N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \left(0 - \color{blue}{\sin \phi_1}\right)\right)\right) \]
            8. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{\_.f64}\left(0, \color{blue}{\sin \phi_1}\right)\right)\right) \]
            9. sin-lowering-sin.f6470.4%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\lambda_2\right), \mathsf{\_.f64}\left(0, \mathsf{sin.f64}\left(\phi_1\right)\right)\right)\right) \]
          13. Simplified70.4%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\cos \lambda_2 \cdot \left(0 - \sin \phi_1\right)}} \]
        3. Recombined 2 regimes into one program.
        4. Final simplification59.1%

          \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -1.85 \cdot 10^{-16}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\ \mathbf{elif}\;\phi_2 \leq 2.9 \cdot 10^{-57}:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\cos \lambda_2 \cdot \left(0 - \sin \phi_1\right)}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}\\ \end{array} \]
        5. Add Preprocessing

        Alternative 30: 47.9% accurate, 2.0× speedup?

        \[\begin{array}{l} \\ \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (atan2 (* (cos phi2) (sin (- lambda1 lambda2))) (sin phi2)))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	return atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2));
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            code = atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2))
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	return Math.atan2((Math.cos(phi2) * Math.sin((lambda1 - lambda2))), Math.sin(phi2));
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	return math.atan2((math.cos(phi2) * math.sin((lambda1 - lambda2))), math.sin(phi2))
        
        function code(lambda1, lambda2, phi1, phi2)
        	return atan(Float64(cos(phi2) * sin(Float64(lambda1 - lambda2))), sin(phi2))
        end
        
        function tmp = code(lambda1, lambda2, phi1, phi2)
        	tmp = atan2((cos(phi2) * sin((lambda1 - lambda2))), sin(phi2));
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[(N[Cos[phi2], $MachinePrecision] * N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}
        \end{array}
        
        Derivation
        1. Initial program 80.2%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6480.2%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified80.2%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Step-by-step derivation
          1. associate-*r*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \sin \phi_1\right) \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
          2. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right) \]
          3. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)}\right)\right)\right) \]
          4. cos-diffN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
          5. flip-+N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_1 \cdot \cos \lambda_2 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right)\right)\right)\right) \]
          6. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\cos \lambda_2 \cdot \cos \lambda_1 - \sin \lambda_1 \cdot \sin \lambda_2} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
          7. fmm-defN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_1 \cdot \sin \lambda_2\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
          8. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \left(\sin \phi_1 \cdot \cos \phi_2\right)\right)\right)\right) \]
          9. sin-cos-multN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}{\color{blue}{2}}\right)\right)\right) \]
          10. clear-numN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\frac{\left(\cos \lambda_1 \cdot \cos \lambda_2\right) \cdot \left(\cos \lambda_1 \cdot \cos \lambda_2\right) - \left(\sin \lambda_1 \cdot \sin \lambda_2\right) \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2\right)}{\mathsf{fma}\left(\cos \lambda_2, \cos \lambda_1, \mathsf{neg}\left(\sin \lambda_2 \cdot \sin \lambda_1\right)\right)} \cdot \frac{1}{\color{blue}{\frac{2}{\sin \left(\phi_1 - \phi_2\right) + \sin \left(\phi_1 + \phi_2\right)}}}\right)\right)\right) \]
        6. Applied egg-rr80.1%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \color{blue}{\frac{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\lambda_1 + \lambda_2\right)\right) \cdot 1}{\cos \left(\lambda_1 + \lambda_2\right) \cdot \frac{1}{\cos \phi_2 \cdot \sin \phi_1}}}} \]
        7. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
        8. Step-by-step derivation
          1. sin-lowering-sin.f6450.4%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
        9. Simplified50.4%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\color{blue}{\sin \phi_2}} \]
        10. Final simplification50.4%

          \[\leadsto \tan^{-1}_* \frac{\cos \phi_2 \cdot \sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2} \]
        11. Add Preprocessing

        Alternative 31: 31.0% accurate, 2.7× speedup?

        \[\begin{array}{l} \\ \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (atan2 (sin (- lambda1 lambda2)) (sin phi2)))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	return atan2(sin((lambda1 - lambda2)), sin(phi2));
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            code = atan2(sin((lambda1 - lambda2)), sin(phi2))
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	return Math.atan2(Math.sin((lambda1 - lambda2)), Math.sin(phi2));
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	return math.atan2(math.sin((lambda1 - lambda2)), math.sin(phi2))
        
        function code(lambda1, lambda2, phi1, phi2)
        	return atan(sin(Float64(lambda1 - lambda2)), sin(phi2))
        end
        
        function tmp = code(lambda1, lambda2, phi1, phi2)
        	tmp = atan2(sin((lambda1 - lambda2)), sin(phi2));
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[Sin[phi2], $MachinePrecision]], $MachinePrecision]
        
        \begin{array}{l}
        
        \\
        \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\sin \phi_2}
        \end{array}
        
        Derivation
        1. Initial program 80.2%

          \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
        2. Step-by-step derivation
          1. atan2-lowering-atan2.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          3. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          5. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
          6. --lowering--.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
          7. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          8. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          9. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
          10. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
          12. associate-*l*N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
          14. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
          15. *-commutativeN/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          16. *-lowering-*.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          17. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
          18. cos-lowering-cos.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6480.2%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        3. Simplified80.2%

          \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
        4. Add Preprocessing
        5. Taylor expanded in phi2 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        6. Step-by-step derivation
          1. sin-lowering-sin.f64N/A

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          2. --lowering--.f6445.0%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
        7. Simplified45.0%

          \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
        8. Taylor expanded in phi1 around 0

          \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
        9. Step-by-step derivation
          1. sin-lowering-sin.f6428.3%

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
        10. Simplified28.3%

          \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\sin \phi_2}} \]
        11. Add Preprocessing

        Alternative 32: 31.1% accurate, 3.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\phi_2 \leq -1.58:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1}{\phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2 \cdot \left(1 + \left(\phi_2 \cdot \phi_2\right) \cdot -0.16666666666666666\right)}\\ \end{array} \end{array} \]
        (FPCore (lambda1 lambda2 phi1 phi2)
         :precision binary64
         (if (<= phi2 -1.58)
           (atan2 (sin lambda1) phi2)
           (atan2
            (sin (- lambda1 lambda2))
            (* phi2 (+ 1.0 (* (* phi2 phi2) -0.16666666666666666))))))
        double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double tmp;
        	if (phi2 <= -1.58) {
        		tmp = atan2(sin(lambda1), phi2);
        	} else {
        		tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0 + ((phi2 * phi2) * -0.16666666666666666))));
        	}
        	return tmp;
        }
        
        real(8) function code(lambda1, lambda2, phi1, phi2)
            real(8), intent (in) :: lambda1
            real(8), intent (in) :: lambda2
            real(8), intent (in) :: phi1
            real(8), intent (in) :: phi2
            real(8) :: tmp
            if (phi2 <= (-1.58d0)) then
                tmp = atan2(sin(lambda1), phi2)
            else
                tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0d0 + ((phi2 * phi2) * (-0.16666666666666666d0)))))
            end if
            code = tmp
        end function
        
        public static double code(double lambda1, double lambda2, double phi1, double phi2) {
        	double tmp;
        	if (phi2 <= -1.58) {
        		tmp = Math.atan2(Math.sin(lambda1), phi2);
        	} else {
        		tmp = Math.atan2(Math.sin((lambda1 - lambda2)), (phi2 * (1.0 + ((phi2 * phi2) * -0.16666666666666666))));
        	}
        	return tmp;
        }
        
        def code(lambda1, lambda2, phi1, phi2):
        	tmp = 0
        	if phi2 <= -1.58:
        		tmp = math.atan2(math.sin(lambda1), phi2)
        	else:
        		tmp = math.atan2(math.sin((lambda1 - lambda2)), (phi2 * (1.0 + ((phi2 * phi2) * -0.16666666666666666))))
        	return tmp
        
        function code(lambda1, lambda2, phi1, phi2)
        	tmp = 0.0
        	if (phi2 <= -1.58)
        		tmp = atan(sin(lambda1), phi2);
        	else
        		tmp = atan(sin(Float64(lambda1 - lambda2)), Float64(phi2 * Float64(1.0 + Float64(Float64(phi2 * phi2) * -0.16666666666666666))));
        	end
        	return tmp
        end
        
        function tmp_2 = code(lambda1, lambda2, phi1, phi2)
        	tmp = 0.0;
        	if (phi2 <= -1.58)
        		tmp = atan2(sin(lambda1), phi2);
        	else
        		tmp = atan2(sin((lambda1 - lambda2)), (phi2 * (1.0 + ((phi2 * phi2) * -0.16666666666666666))));
        	end
        	tmp_2 = tmp;
        end
        
        code[lambda1_, lambda2_, phi1_, phi2_] := If[LessEqual[phi2, -1.58], N[ArcTan[N[Sin[lambda1], $MachinePrecision] / phi2], $MachinePrecision], N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / N[(phi2 * N[(1.0 + N[(N[(phi2 * phi2), $MachinePrecision] * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;\phi_2 \leq -1.58:\\
        \;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1}{\phi_2}\\
        
        \mathbf{else}:\\
        \;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2 \cdot \left(1 + \left(\phi_2 \cdot \phi_2\right) \cdot -0.16666666666666666\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if phi2 < -1.5800000000000001

          1. Initial program 76.0%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6476.0%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified76.0%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f6414.7%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. Simplified14.7%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          8. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          9. Step-by-step derivation
            1. sin-lowering-sin.f6411.7%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          10. Simplified11.7%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\sin \phi_2}} \]
          11. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\phi_2}\right) \]
          12. Step-by-step derivation
            1. Simplified12.1%

              \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\phi_2}} \]
            2. Taylor expanded in lambda2 around 0

              \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \lambda_1}, \phi_2\right) \]
            3. Step-by-step derivation
              1. sin-lowering-sin.f6415.5%

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \phi_2\right) \]
            4. Simplified15.5%

              \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1}}{\phi_2} \]

            if -1.5800000000000001 < phi2

            1. Initial program 81.6%

              \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
            2. Step-by-step derivation
              1. atan2-lowering-atan2.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
              2. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
              3. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
              4. --lowering--.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
              5. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
              6. --lowering--.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
              7. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
              8. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
              9. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
              10. associate-*l*N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
              12. associate-*l*N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
              13. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
              14. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
              15. *-commutativeN/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
              16. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
              17. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
              18. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
              19. --lowering--.f6481.6%

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            3. Simplified81.6%

              \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
            4. Add Preprocessing
            5. Taylor expanded in phi2 around 0

              \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            6. Step-by-step derivation
              1. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
              2. --lowering--.f6455.5%

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            7. Simplified55.5%

              \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
            8. Taylor expanded in phi1 around 0

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
            9. Step-by-step derivation
              1. sin-lowering-sin.f6434.1%

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
            10. Simplified34.1%

              \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\sin \phi_2}} \]
            11. Taylor expanded in phi2 around 0

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\left(\phi_2 \cdot \left(1 + \frac{-1}{6} \cdot {\phi_2}^{2}\right)\right)}\right) \]
            12. Step-by-step derivation
              1. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\phi_2, \color{blue}{\left(1 + \frac{-1}{6} \cdot {\phi_2}^{2}\right)}\right)\right) \]
              2. +-lowering-+.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\phi_2, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{-1}{6} \cdot {\phi_2}^{2}\right)}\right)\right)\right) \]
              3. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\phi_2, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \color{blue}{\left({\phi_2}^{2}\right)}\right)\right)\right)\right) \]
              4. unpow2N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\phi_2, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \left(\phi_2 \cdot \color{blue}{\phi_2}\right)\right)\right)\right)\right) \]
              5. *-lowering-*.f6434.1%

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{*.f64}\left(\phi_2, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\phi_2, \color{blue}{\phi_2}\right)\right)\right)\right)\right) \]
            13. Simplified34.1%

              \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\phi_2 \cdot \left(1 + -0.16666666666666666 \cdot \left(\phi_2 \cdot \phi_2\right)\right)}} \]
          13. Recombined 2 regimes into one program.
          14. Final simplification29.3%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -1.58:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \lambda_1}{\phi_2}\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2 \cdot \left(1 + \left(\phi_2 \cdot \phi_2\right) \cdot -0.16666666666666666\right)}\\ \end{array} \]
          15. Add Preprocessing

          Alternative 33: 28.5% accurate, 4.0× speedup?

          \[\begin{array}{l} \\ \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2} \end{array} \]
          (FPCore (lambda1 lambda2 phi1 phi2)
           :precision binary64
           (atan2 (sin (- lambda1 lambda2)) phi2))
          double code(double lambda1, double lambda2, double phi1, double phi2) {
          	return atan2(sin((lambda1 - lambda2)), phi2);
          }
          
          real(8) function code(lambda1, lambda2, phi1, phi2)
              real(8), intent (in) :: lambda1
              real(8), intent (in) :: lambda2
              real(8), intent (in) :: phi1
              real(8), intent (in) :: phi2
              code = atan2(sin((lambda1 - lambda2)), phi2)
          end function
          
          public static double code(double lambda1, double lambda2, double phi1, double phi2) {
          	return Math.atan2(Math.sin((lambda1 - lambda2)), phi2);
          }
          
          def code(lambda1, lambda2, phi1, phi2):
          	return math.atan2(math.sin((lambda1 - lambda2)), phi2)
          
          function code(lambda1, lambda2, phi1, phi2)
          	return atan(sin(Float64(lambda1 - lambda2)), phi2)
          end
          
          function tmp = code(lambda1, lambda2, phi1, phi2)
          	tmp = atan2(sin((lambda1 - lambda2)), phi2);
          end
          
          code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision] / phi2], $MachinePrecision]
          
          \begin{array}{l}
          
          \\
          \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\phi_2}
          \end{array}
          
          Derivation
          1. Initial program 80.2%

            \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
          2. Step-by-step derivation
            1. atan2-lowering-atan2.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
            2. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            3. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            4. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            5. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
            6. --lowering--.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            9. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
            10. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
            11. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
            12. associate-*l*N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            13. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
            14. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
            15. *-commutativeN/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            16. *-lowering-*.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            17. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
            18. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
            19. --lowering--.f6480.2%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          3. Simplified80.2%

            \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
          4. Add Preprocessing
          5. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. sin-lowering-sin.f64N/A

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            2. --lowering--.f6445.0%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
          7. Simplified45.0%

            \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
          8. Taylor expanded in phi1 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
          9. Step-by-step derivation
            1. sin-lowering-sin.f6428.3%

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
          10. Simplified28.3%

            \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\sin \phi_2}} \]
          11. Taylor expanded in phi2 around 0

            \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\phi_2}\right) \]
          12. Step-by-step derivation
            1. Simplified25.7%

              \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\phi_2}} \]
            2. Add Preprocessing

            Alternative 34: 21.7% accurate, 4.0× speedup?

            \[\begin{array}{l} \\ \tan^{-1}_* \frac{\sin \lambda_1}{\phi_2} \end{array} \]
            (FPCore (lambda1 lambda2 phi1 phi2)
             :precision binary64
             (atan2 (sin lambda1) phi2))
            double code(double lambda1, double lambda2, double phi1, double phi2) {
            	return atan2(sin(lambda1), phi2);
            }
            
            real(8) function code(lambda1, lambda2, phi1, phi2)
                real(8), intent (in) :: lambda1
                real(8), intent (in) :: lambda2
                real(8), intent (in) :: phi1
                real(8), intent (in) :: phi2
                code = atan2(sin(lambda1), phi2)
            end function
            
            public static double code(double lambda1, double lambda2, double phi1, double phi2) {
            	return Math.atan2(Math.sin(lambda1), phi2);
            }
            
            def code(lambda1, lambda2, phi1, phi2):
            	return math.atan2(math.sin(lambda1), phi2)
            
            function code(lambda1, lambda2, phi1, phi2)
            	return atan(sin(lambda1), phi2)
            end
            
            function tmp = code(lambda1, lambda2, phi1, phi2)
            	tmp = atan2(sin(lambda1), phi2);
            end
            
            code[lambda1_, lambda2_, phi1_, phi2_] := N[ArcTan[N[Sin[lambda1], $MachinePrecision] / phi2], $MachinePrecision]
            
            \begin{array}{l}
            
            \\
            \tan^{-1}_* \frac{\sin \lambda_1}{\phi_2}
            \end{array}
            
            Derivation
            1. Initial program 80.2%

              \[\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)} \]
            2. Step-by-step derivation
              1. atan2-lowering-atan2.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\left(\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2\right), \color{blue}{\left(\cos \phi_1 \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right) \]
              2. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\sin \left(\lambda_1 - \lambda_2\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1 \cdot \sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
              3. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \cos \phi_2\right), \left(\color{blue}{\cos \phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
              4. --lowering--.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \cos \phi_2\right), \left(\cos \color{blue}{\phi_1} \cdot \sin \phi_2 - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
              5. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \left(\cos \phi_1 \cdot \color{blue}{\sin \phi_2} - \left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) \]
              6. --lowering--.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\left(\cos \phi_1 \cdot \sin \phi_2\right), \color{blue}{\left(\left(\sin \phi_1 \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right) \]
              7. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\cos \phi_1, \sin \phi_2\right), \left(\color{blue}{\left(\sin \phi_1 \cdot \cos \phi_2\right)} \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
              8. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \sin \phi_2\right), \left(\left(\color{blue}{\sin \phi_1} \cdot \cos \phi_2\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
              9. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\sin \phi_1 \cdot \color{blue}{\cos \phi_2}\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) \]
              10. associate-*l*N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\sin \phi_1 \cdot \color{blue}{\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}\right)\right)\right) \]
              11. *-commutativeN/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\left(\cos \phi_2 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right) \cdot \color{blue}{\sin \phi_1}\right)\right)\right) \]
              12. associate-*l*N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \left(\cos \phi_2 \cdot \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
              13. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\cos \phi_2, \color{blue}{\left(\cos \left(\lambda_1 - \lambda_2\right) \cdot \sin \phi_1\right)}\right)\right)\right) \]
              14. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)} \cdot \sin \phi_1\right)\right)\right)\right) \]
              15. *-commutativeN/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \left(\sin \phi_1 \cdot \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
              16. *-lowering-*.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\sin \phi_1, \color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
              17. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \cos \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)\right)\right)\right) \]
              18. cos-lowering-cos.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\left(\lambda_1 - \lambda_2\right)\right)\right)\right)\right)\right) \]
              19. --lowering--.f6480.2%

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{*.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{cos.f64}\left(\phi_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            3. Simplified80.2%

              \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right) \cdot \cos \phi_2}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}} \]
            4. Add Preprocessing
            5. Taylor expanded in phi2 around 0

              \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            6. Step-by-step derivation
              1. sin-lowering-sin.f64N/A

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\left(\lambda_1 - \lambda_2\right)\right), \mathsf{\_.f64}\left(\color{blue}{\mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_1\right), \mathsf{sin.f64}\left(\phi_2\right)\right)}, \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
              2. --lowering--.f6445.0%

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{cos.f64}\left(\phi_1\right)}, \mathsf{sin.f64}\left(\phi_2\right)\right), \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\phi_2\right), \mathsf{*.f64}\left(\mathsf{sin.f64}\left(\phi_1\right), \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right)\right)\right)\right)\right) \]
            7. Simplified45.0%

              \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \left(\lambda_1 - \lambda_2\right)}}{\cos \phi_1 \cdot \sin \phi_2 - \cos \phi_2 \cdot \left(\sin \phi_1 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)} \]
            8. Taylor expanded in phi1 around 0

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\sin \phi_2}\right) \]
            9. Step-by-step derivation
              1. sin-lowering-sin.f6428.3%

                \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \mathsf{sin.f64}\left(\phi_2\right)\right) \]
            10. Simplified28.3%

              \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\sin \phi_2}} \]
            11. Taylor expanded in phi2 around 0

              \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\mathsf{\_.f64}\left(\lambda_1, \lambda_2\right)\right), \color{blue}{\phi_2}\right) \]
            12. Step-by-step derivation
              1. Simplified25.7%

                \[\leadsto \tan^{-1}_* \frac{\sin \left(\lambda_1 - \lambda_2\right)}{\color{blue}{\phi_2}} \]
              2. Taylor expanded in lambda2 around 0

                \[\leadsto \mathsf{atan2.f64}\left(\color{blue}{\sin \lambda_1}, \phi_2\right) \]
              3. Step-by-step derivation
                1. sin-lowering-sin.f6421.0%

                  \[\leadsto \mathsf{atan2.f64}\left(\mathsf{sin.f64}\left(\lambda_1\right), \phi_2\right) \]
              4. Simplified21.0%

                \[\leadsto \tan^{-1}_* \frac{\color{blue}{\sin \lambda_1}}{\phi_2} \]
              5. Add Preprocessing

              Reproduce

              ?
              herbie shell --seed 2024145 
              (FPCore (lambda1 lambda2 phi1 phi2)
                :name "Bearing on a great circle"
                :precision binary64
                (atan2 (* (sin (- lambda1 lambda2)) (cos phi2)) (- (* (cos phi1) (sin phi2)) (* (* (sin phi1) (cos phi2)) (cos (- lambda1 lambda2))))))