Distance on a great circle

Percentage Accurate: 61.7% → 78.8%
Time: 1.2min
Alternatives: 27
Speedup: 1.1×

Specification

?
\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1}}{\sqrt{1 - t\_1}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_1
         (+
          (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
          (* (* (* (cos phi1) (cos phi2)) t_0) t_0))))
   (* R (* 2.0 (atan2 (sqrt t_1) (sqrt (- 1.0 t_1)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(((lambda1 - lambda2) / 2.0));
	double t_1 = pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0);
	return R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    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
    t_0 = sin(((lambda1 - lambda2) / 2.0d0))
    t_1 = (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0)
    code = r * (2.0d0 * atan2(sqrt(t_1), sqrt((1.0d0 - t_1))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
	double t_1 = Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((Math.cos(phi1) * Math.cos(phi2)) * t_0) * t_0);
	return R * (2.0 * Math.atan2(Math.sqrt(t_1), Math.sqrt((1.0 - t_1))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
	t_1 = math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((math.cos(phi1) * math.cos(phi2)) * t_0) * t_0)
	return R * (2.0 * math.atan2(math.sqrt(t_1), math.sqrt((1.0 - t_1))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_1 = Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0))
	return Float64(R * Float64(2.0 * atan(sqrt(t_1), sqrt(Float64(1.0 - t_1)))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(((lambda1 - lambda2) / 2.0));
	t_1 = (sin(((phi1 - phi2) / 2.0)) ^ 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0);
	tmp = R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$1], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1}}{\sqrt{1 - t\_1}}\right)
\end{array}
\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 27 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: 61.7% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1}}{\sqrt{1 - t\_1}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_1
         (+
          (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
          (* (* (* (cos phi1) (cos phi2)) t_0) t_0))))
   (* R (* 2.0 (atan2 (sqrt t_1) (sqrt (- 1.0 t_1)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(((lambda1 - lambda2) / 2.0));
	double t_1 = pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0);
	return R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    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
    t_0 = sin(((lambda1 - lambda2) / 2.0d0))
    t_1 = (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0)
    code = r * (2.0d0 * atan2(sqrt(t_1), sqrt((1.0d0 - t_1))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
	double t_1 = Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((Math.cos(phi1) * Math.cos(phi2)) * t_0) * t_0);
	return R * (2.0 * Math.atan2(Math.sqrt(t_1), Math.sqrt((1.0 - t_1))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
	t_1 = math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0) + (((math.cos(phi1) * math.cos(phi2)) * t_0) * t_0)
	return R * (2.0 * math.atan2(math.sqrt(t_1), math.sqrt((1.0 - t_1))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_1 = Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0))
	return Float64(R * Float64(2.0 * atan(sqrt(t_1), sqrt(Float64(1.0 - t_1)))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(((lambda1 - lambda2) / 2.0));
	t_1 = (sin(((phi1 - phi2) / 2.0)) ^ 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0);
	tmp = R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$1], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1}}{\sqrt{1 - t\_1}}\right)
\end{array}
\end{array}

Alternative 1: 78.8% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_2 + t\_1 \cdot \left(t\_0 \cdot t\_1\right)}}{\sqrt{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(t\_0, {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2}, t\_2\right)\right)}}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi1) (cos phi2)))
        (t_1 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_2
         (pow
          (fma
           (cos (* -0.5 phi2))
           (sin (* 0.5 phi1))
           (* (sin (* -0.5 phi2)) (cos (* 0.5 phi1))))
          2.0)))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (+ t_2 (* t_1 (* t_0 t_1))))
      (sqrt
       (exp
        (log1p
         (-
          (fma
           t_0
           (pow
            (-
             (* (sin (/ lambda1 2.0)) (cos (/ lambda2 2.0)))
             (* (cos (/ lambda1 2.0)) (sin (/ lambda2 2.0))))
            2.0)
           t_2))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * cos(phi2);
	double t_1 = sin(((lambda1 - lambda2) / 2.0));
	double t_2 = pow(fma(cos((-0.5 * phi2)), sin((0.5 * phi1)), (sin((-0.5 * phi2)) * cos((0.5 * phi1)))), 2.0);
	return R * (2.0 * atan2(sqrt((t_2 + (t_1 * (t_0 * t_1)))), sqrt(exp(log1p(-fma(t_0, pow(((sin((lambda1 / 2.0)) * cos((lambda2 / 2.0))) - (cos((lambda1 / 2.0)) * sin((lambda2 / 2.0)))), 2.0), t_2))))));
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * cos(phi2))
	t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_2 = fma(cos(Float64(-0.5 * phi2)), sin(Float64(0.5 * phi1)), Float64(sin(Float64(-0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(t_2 + Float64(t_1 * Float64(t_0 * t_1)))), sqrt(exp(log1p(Float64(-fma(t_0, (Float64(Float64(sin(Float64(lambda1 / 2.0)) * cos(Float64(lambda2 / 2.0))) - Float64(cos(Float64(lambda1 / 2.0)) * sin(Float64(lambda2 / 2.0)))) ^ 2.0), t_2))))))))
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$2 + N[(t$95$1 * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[Exp[N[Log[1 + (-N[(t$95$0 * N[Power[N[(N[(N[Sin[N[(lambda1 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(lambda2 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(lambda1 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(lambda2 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision])], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_2 + t\_1 \cdot \left(t\_0 \cdot t\_1\right)}}{\sqrt{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(t\_0, {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2}, t\_2\right)\right)}}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  8. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  9. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  10. Simplified80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  11. Step-by-step derivation
    1. add-exp-log80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{e^{\log \left(1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)}}}}\right) \]
    2. sub-neg80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\log \color{blue}{\left(1 + \left(-\left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)\right)}}}}\right) \]
    3. log1p-define80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\color{blue}{\mathsf{log1p}\left(-\left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)}}}}\right) \]
  12. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(\phi_1 \cdot 0.5\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)\right)}^{2}\right)\right)}}}}\right) \]
  13. Step-by-step derivation
    1. metadata-eval80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{\frac{1}{2}}\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(\phi_1 \cdot 0.5\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)\right)}^{2}\right)\right)}}}\right) \]
    2. div-inv80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \color{blue}{\left(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(\phi_1 \cdot 0.5\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)\right)}^{2}\right)\right)}}}\right) \]
    3. div-sub80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \color{blue}{\left(\frac{\lambda_1}{2} - \frac{\lambda_2}{2}\right)}}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(\phi_1 \cdot 0.5\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)\right)}^{2}\right)\right)}}}\right) \]
    4. sin-diff81.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\color{blue}{\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(\phi_1 \cdot 0.5\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)\right)}^{2}\right)\right)}}}\right) \]
  14. Applied egg-rr81.0%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\color{blue}{\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(\phi_1 \cdot 0.5\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)\right)}^{2}\right)\right)}}}\right) \]
  15. Final simplification81.0%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\right)\right)}}}\right) \]
  16. Add Preprocessing

Alternative 2: 78.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_2 + t\_1 \cdot \left(t\_0 \cdot t\_1\right)}}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt{1 - \mathsf{fma}\left(t\_0, {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, t\_2\right)}\right)\right)}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi1) (cos phi2)))
        (t_1 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_2
         (pow
          (fma
           (cos (* -0.5 phi2))
           (sin (* 0.5 phi1))
           (* (sin (* -0.5 phi2)) (cos (* 0.5 phi1))))
          2.0)))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (+ t_2 (* t_1 (* t_0 t_1))))
      (log1p
       (expm1
        (sqrt
         (-
          1.0
          (fma t_0 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0) t_2))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * cos(phi2);
	double t_1 = sin(((lambda1 - lambda2) / 2.0));
	double t_2 = pow(fma(cos((-0.5 * phi2)), sin((0.5 * phi1)), (sin((-0.5 * phi2)) * cos((0.5 * phi1)))), 2.0);
	return R * (2.0 * atan2(sqrt((t_2 + (t_1 * (t_0 * t_1)))), log1p(expm1(sqrt((1.0 - fma(t_0, pow(sin((0.5 * (lambda1 - lambda2))), 2.0), t_2)))))));
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * cos(phi2))
	t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_2 = fma(cos(Float64(-0.5 * phi2)), sin(Float64(0.5 * phi1)), Float64(sin(Float64(-0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(t_2 + Float64(t_1 * Float64(t_0 * t_1)))), log1p(expm1(sqrt(Float64(1.0 - fma(t_0, (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0), t_2))))))))
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$2 + N[(t$95$1 * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Log[1 + N[(Exp[N[Sqrt[N[(1.0 - N[(t$95$0 * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_2 + t\_1 \cdot \left(t\_0 \cdot t\_1\right)}}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt{1 - \mathsf{fma}\left(t\_0, {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, t\_2\right)}\right)\right)}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  8. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  9. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  10. Simplified80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  11. Step-by-step derivation
    1. add-exp-log80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{e^{\log \left(1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)}}}}\right) \]
    2. sub-neg80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\log \color{blue}{\left(1 + \left(-\left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)\right)}}}}\right) \]
    3. log1p-define80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\color{blue}{\mathsf{log1p}\left(-\left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)}}}}\right) \]
  12. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(\phi_1 \cdot 0.5\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)\right)}^{2}\right)\right)}}}}\right) \]
  13. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\color{blue}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt{1 + \left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\right)\right)}\right)\right)}}\right) \]
  14. Final simplification80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\mathsf{log1p}\left(\mathsf{expm1}\left(\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\right)}\right)\right)}\right) \]
  15. Add Preprocessing

Alternative 3: 78.2% accurate, 0.6× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_2 + t\_1 \cdot \left(t\_0 \cdot t\_1\right)}}{{\left({\left(1 - \mathsf{fma}\left(t\_0, {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, t\_2\right)\right)}^{1.5}\right)}^{0.3333333333333333}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi1) (cos phi2)))
        (t_1 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_2
         (pow
          (fma
           (cos (* -0.5 phi2))
           (sin (* 0.5 phi1))
           (* (sin (* -0.5 phi2)) (cos (* 0.5 phi1))))
          2.0)))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (+ t_2 (* t_1 (* t_0 t_1))))
      (pow
       (pow
        (- 1.0 (fma t_0 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0) t_2))
        1.5)
       0.3333333333333333))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * cos(phi2);
	double t_1 = sin(((lambda1 - lambda2) / 2.0));
	double t_2 = pow(fma(cos((-0.5 * phi2)), sin((0.5 * phi1)), (sin((-0.5 * phi2)) * cos((0.5 * phi1)))), 2.0);
	return R * (2.0 * atan2(sqrt((t_2 + (t_1 * (t_0 * t_1)))), pow(pow((1.0 - fma(t_0, pow(sin((0.5 * (lambda1 - lambda2))), 2.0), t_2)), 1.5), 0.3333333333333333)));
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * cos(phi2))
	t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_2 = fma(cos(Float64(-0.5 * phi2)), sin(Float64(0.5 * phi1)), Float64(sin(Float64(-0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(t_2 + Float64(t_1 * Float64(t_0 * t_1)))), ((Float64(1.0 - fma(t_0, (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0), t_2)) ^ 1.5) ^ 0.3333333333333333))))
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[(N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$2 + N[(t$95$1 * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Power[N[Power[N[(1.0 - N[(t$95$0 * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + t$95$2), $MachinePrecision]), $MachinePrecision], 1.5], $MachinePrecision], 0.3333333333333333], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_2 + t\_1 \cdot \left(t\_0 \cdot t\_1\right)}}{{\left({\left(1 - \mathsf{fma}\left(t\_0, {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, t\_2\right)\right)}^{1.5}\right)}^{0.3333333333333333}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  8. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  9. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  10. Simplified80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  11. Step-by-step derivation
    1. add-exp-log80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{e^{\log \left(1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)}}}}\right) \]
    2. sub-neg80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\log \color{blue}{\left(1 + \left(-\left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)\right)}}}}\right) \]
    3. log1p-define80.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{e^{\color{blue}{\mathsf{log1p}\left(-\left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right)}}}}\right) \]
  12. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{e^{\mathsf{log1p}\left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(\phi_1 \cdot 0.5\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)\right)}^{2}\right)\right)}}}}\right) \]
  13. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\color{blue}{{\left({\left(1 + \left(-\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot -0.5\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot -0.5\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\right)\right)\right)}^{1.5}\right)}^{0.3333333333333333}}}\right) \]
  14. Final simplification80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{{\left({\left(1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}\right)\right)}^{1.5}\right)}^{0.3333333333333333}}\right) \]
  15. Add Preprocessing

Alternative 4: 78.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1}}{\sqrt{1 - t\_1}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_1
         (+
          (pow
           (fma
            (cos (* -0.5 phi2))
            (sin (* 0.5 phi1))
            (* (sin (* -0.5 phi2)) (cos (* 0.5 phi1))))
           2.0)
          (* t_0 (* (* (cos phi1) (cos phi2)) t_0)))))
   (* R (* 2.0 (atan2 (sqrt t_1) (sqrt (- 1.0 t_1)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(((lambda1 - lambda2) / 2.0));
	double t_1 = pow(fma(cos((-0.5 * phi2)), sin((0.5 * phi1)), (sin((-0.5 * phi2)) * cos((0.5 * phi1)))), 2.0) + (t_0 * ((cos(phi1) * cos(phi2)) * t_0));
	return R * (2.0 * atan2(sqrt(t_1), sqrt((1.0 - t_1))));
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_1 = Float64((fma(cos(Float64(-0.5 * phi2)), sin(Float64(0.5 * phi1)), Float64(sin(Float64(-0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0) + Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)))
	return Float64(R * Float64(2.0 * atan(sqrt(t_1), sqrt(Float64(1.0 - t_1)))))
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Power[N[(N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$1], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := {\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1}}{\sqrt{1 - t\_1}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  8. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  9. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  10. Simplified80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  11. Final simplification80.5%

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

Alternative 5: 78.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \left(0.5 \cdot \phi_1\right)\\ t_1 := \sin \left(0.5 \cdot \phi_1\right)\\ t_2 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_3 := t\_2 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_2\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_3 + {\left(t\_1 \cdot \cos \left(\phi_2 \cdot 0.5\right) - t\_0 \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), t\_1, \sin \left(-0.5 \cdot \phi_2\right) \cdot t\_0\right)\right)}^{2} + t\_3\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (cos (* 0.5 phi1)))
        (t_1 (sin (* 0.5 phi1)))
        (t_2 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_3 (* t_2 (* (* (cos phi1) (cos phi2)) t_2))))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt
       (+
        t_3
        (pow (- (* t_1 (cos (* phi2 0.5))) (* t_0 (sin (* phi2 0.5)))) 2.0)))
      (sqrt
       (-
        1.0
        (+
         (pow (fma (cos (* -0.5 phi2)) t_1 (* (sin (* -0.5 phi2)) t_0)) 2.0)
         t_3))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos((0.5 * phi1));
	double t_1 = sin((0.5 * phi1));
	double t_2 = sin(((lambda1 - lambda2) / 2.0));
	double t_3 = t_2 * ((cos(phi1) * cos(phi2)) * t_2);
	return R * (2.0 * atan2(sqrt((t_3 + pow(((t_1 * cos((phi2 * 0.5))) - (t_0 * sin((phi2 * 0.5)))), 2.0))), sqrt((1.0 - (pow(fma(cos((-0.5 * phi2)), t_1, (sin((-0.5 * phi2)) * t_0)), 2.0) + t_3)))));
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = cos(Float64(0.5 * phi1))
	t_1 = sin(Float64(0.5 * phi1))
	t_2 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_3 = Float64(t_2 * Float64(Float64(cos(phi1) * cos(phi2)) * t_2))
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(t_3 + (Float64(Float64(t_1 * cos(Float64(phi2 * 0.5))) - Float64(t_0 * sin(Float64(phi2 * 0.5)))) ^ 2.0))), sqrt(Float64(1.0 - Float64((fma(cos(Float64(-0.5 * phi2)), t_1, Float64(sin(Float64(-0.5 * phi2)) * t_0)) ^ 2.0) + t_3))))))
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$2 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$3 + N[Power[N[(N[(t$95$1 * N[Cos[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(t$95$0 * N[Sin[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * t$95$1 + N[(N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$3), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot \phi_1\right)\\
t_1 := \sin \left(0.5 \cdot \phi_1\right)\\
t_2 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_3 := t\_2 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_2\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_3 + {\left(t\_1 \cdot \cos \left(\phi_2 \cdot 0.5\right) - t\_0 \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), t\_1, \sin \left(-0.5 \cdot \phi_2\right) \cdot t\_0\right)\right)}^{2} + t\_3\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  8. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  9. Final simplification80.5%

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

Alternative 6: 78.2% accurate, 0.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + {\left(\cos \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) + \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_0}}{\sqrt{1 - t\_0}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0
         (+
          (*
           (cos phi1)
           (* (cos phi2) (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))
          (pow
           (+
            (* (cos (* -0.5 phi2)) (sin (* 0.5 phi1)))
            (* (sin (* -0.5 phi2)) (cos (* 0.5 phi1))))
           2.0))))
   (* R (* 2.0 (atan2 (sqrt t_0) (sqrt (- 1.0 t_0)))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = (cos(phi1) * (cos(phi2) * pow(sin((0.5 * (lambda1 - lambda2))), 2.0))) + pow(((cos((-0.5 * phi2)) * sin((0.5 * phi1))) + (sin((-0.5 * phi2)) * cos((0.5 * phi1)))), 2.0);
	return R * (2.0 * atan2(sqrt(t_0), sqrt((1.0 - t_0))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    t_0 = (cos(phi1) * (cos(phi2) * (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0))) + (((cos(((-0.5d0) * phi2)) * sin((0.5d0 * phi1))) + (sin(((-0.5d0) * phi2)) * cos((0.5d0 * phi1)))) ** 2.0d0)
    code = r * (2.0d0 * atan2(sqrt(t_0), sqrt((1.0d0 - t_0))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = (Math.cos(phi1) * (Math.cos(phi2) * Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0))) + Math.pow(((Math.cos((-0.5 * phi2)) * Math.sin((0.5 * phi1))) + (Math.sin((-0.5 * phi2)) * Math.cos((0.5 * phi1)))), 2.0);
	return R * (2.0 * Math.atan2(Math.sqrt(t_0), Math.sqrt((1.0 - t_0))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = (math.cos(phi1) * (math.cos(phi2) * math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0))) + math.pow(((math.cos((-0.5 * phi2)) * math.sin((0.5 * phi1))) + (math.sin((-0.5 * phi2)) * math.cos((0.5 * phi1)))), 2.0)
	return R * (2.0 * math.atan2(math.sqrt(t_0), math.sqrt((1.0 - t_0))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(Float64(cos(phi1) * Float64(cos(phi2) * (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0))) + (Float64(Float64(cos(Float64(-0.5 * phi2)) * sin(Float64(0.5 * phi1))) + Float64(sin(Float64(-0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0))
	return Float64(R * Float64(2.0 * atan(sqrt(t_0), sqrt(Float64(1.0 - t_0)))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = (cos(phi1) * (cos(phi2) * (sin((0.5 * (lambda1 - lambda2))) ^ 2.0))) + (((cos((-0.5 * phi2)) * sin((0.5 * phi1))) + (sin((-0.5 * phi2)) * cos((0.5 * phi1)))) ^ 2.0);
	tmp = R * (2.0 * atan2(sqrt(t_0), sqrt((1.0 - t_0))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$0], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + {\left(\cos \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) + \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_0}}{\sqrt{1 - t\_0}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  8. Applied egg-rr80.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  9. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  10. Simplified80.5%

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

    \[\leadsto R \cdot \color{blue}{\left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + {\left(\cos \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) + \cos \left(0.5 \cdot \phi_1\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)\right)}^{2}}}{\sqrt{1 - \left(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + {\left(\cos \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) + \cos \left(0.5 \cdot \phi_1\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)\right)}^{2}\right)}}\right)} \]
  12. Final simplification80.4%

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

Alternative 7: 62.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + t\_1\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_1 (* t_0 (* (* (cos phi1) (cos phi2)) t_0))))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (+ t_1 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
      (sqrt
       (-
        1.0
        (+
         (pow
          (fma
           (cos (* -0.5 phi2))
           (sin (* 0.5 phi1))
           (* (sin (* -0.5 phi2)) (cos (* 0.5 phi1))))
          2.0)
         t_1))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(((lambda1 - lambda2) / 2.0));
	double t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
	return R * (2.0 * atan2(sqrt((t_1 + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 - (pow(fma(cos((-0.5 * phi2)), sin((0.5 * phi1)), (sin((-0.5 * phi2)) * cos((0.5 * phi1)))), 2.0) + t_1)))));
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_1 = Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0))
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 - Float64((fma(cos(Float64(-0.5 * phi2)), sin(Float64(0.5 * phi1)), Float64(sin(Float64(-0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0) + t_1))))))
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + t\_1\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Final simplification65.4%

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

Alternative 8: 62.7% accurate, 0.8× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_0 + {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}{\sqrt{1 - \left(t\_0 + {\left(\cos \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) + \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)}^{2}\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0
         (*
          (cos phi1)
          (* (cos phi2) (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (+ t_0 (pow (sin (* 0.5 (- phi1 phi2))) 2.0)))
      (sqrt
       (-
        1.0
        (+
         t_0
         (pow
          (+
           (* (cos (* -0.5 phi2)) (sin (* 0.5 phi1)))
           (* (sin (* -0.5 phi2)) (cos (* 0.5 phi1))))
          2.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * (cos(phi2) * pow(sin((0.5 * (lambda1 - lambda2))), 2.0));
	return R * (2.0 * atan2(sqrt((t_0 + pow(sin((0.5 * (phi1 - phi2))), 2.0))), sqrt((1.0 - (t_0 + pow(((cos((-0.5 * phi2)) * sin((0.5 * phi1))) + (sin((-0.5 * phi2)) * cos((0.5 * phi1)))), 2.0))))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    t_0 = cos(phi1) * (cos(phi2) * (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0))
    code = r * (2.0d0 * atan2(sqrt((t_0 + (sin((0.5d0 * (phi1 - phi2))) ** 2.0d0))), sqrt((1.0d0 - (t_0 + (((cos(((-0.5d0) * phi2)) * sin((0.5d0 * phi1))) + (sin(((-0.5d0) * phi2)) * cos((0.5d0 * phi1)))) ** 2.0d0))))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos(phi1) * (Math.cos(phi2) * Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0));
	return R * (2.0 * Math.atan2(Math.sqrt((t_0 + Math.pow(Math.sin((0.5 * (phi1 - phi2))), 2.0))), Math.sqrt((1.0 - (t_0 + Math.pow(((Math.cos((-0.5 * phi2)) * Math.sin((0.5 * phi1))) + (Math.sin((-0.5 * phi2)) * Math.cos((0.5 * phi1)))), 2.0))))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.cos(phi1) * (math.cos(phi2) * math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0))
	return R * (2.0 * math.atan2(math.sqrt((t_0 + math.pow(math.sin((0.5 * (phi1 - phi2))), 2.0))), math.sqrt((1.0 - (t_0 + math.pow(((math.cos((-0.5 * phi2)) * math.sin((0.5 * phi1))) + (math.sin((-0.5 * phi2)) * math.cos((0.5 * phi1)))), 2.0))))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * Float64(cos(phi2) * (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0)))
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(t_0 + (sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0))), sqrt(Float64(1.0 - Float64(t_0 + (Float64(Float64(cos(Float64(-0.5 * phi2)) * sin(Float64(0.5 * phi1))) + Float64(sin(Float64(-0.5 * phi2)) * cos(Float64(0.5 * phi1)))) ^ 2.0)))))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = cos(phi1) * (cos(phi2) * (sin((0.5 * (lambda1 - lambda2))) ^ 2.0));
	tmp = R * (2.0 * atan2(sqrt((t_0 + (sin((0.5 * (phi1 - phi2))) ^ 2.0))), sqrt((1.0 - (t_0 + (((cos((-0.5 * phi2)) * sin((0.5 * phi1))) + (sin((-0.5 * phi2)) * cos((0.5 * phi1)))) ^ 2.0))))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$0 + N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$0 + N[Power[N[(N[(N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] + N[(N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_0 + {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}{\sqrt{1 - \left(t\_0 + {\left(\cos \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) + \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)}^{2}\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. *-commutative65.4%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \color{blue}{\left(0.5 \cdot \phi_1\right)} - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. fma-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot 0.5\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. cos-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\color{blue}{\cos \left(-\phi_2 \cdot 0.5\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(\phi_2 \cdot \color{blue}{-0.5}\right), \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \color{blue}{\left(-0.5 \cdot \phi_2\right)}, \sin \left(0.5 \cdot \phi_1\right), -\cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\color{blue}{\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \left(\phi_1 \cdot 0.5\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), -\sin \left(\phi_2 \cdot 0.5\right) \cdot \cos \color{blue}{\left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. distribute-lft-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\left(-\sin \left(\phi_2 \cdot 0.5\right)\right) \cdot \cos \left(0.5 \cdot \phi_1\right)}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    11. sin-neg65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \color{blue}{\sin \left(-\phi_2 \cdot 0.5\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    12. distribute-rgt-neg-in65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(\phi_2 \cdot \left(-0.5\right)\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    13. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(\phi_2 \cdot \color{blue}{-0.5}\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    14. *-commutative65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \color{blue}{\left(-0.5 \cdot \phi_2\right)} \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified65.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\cos \left(-0.5 \cdot \phi_2\right), \sin \left(0.5 \cdot \phi_1\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Taylor expanded in phi1 around 0 65.4%

    \[\leadsto R \cdot \color{blue}{\left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}{\sqrt{1 - \left(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + {\left(\cos \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(0.5 \cdot \phi_1\right) + \cos \left(0.5 \cdot \phi_1\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)\right)}^{2}\right)}}\right)} \]
  8. Final simplification65.4%

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

Alternative 9: 62.2% accurate, 0.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 \cdot \left(t\_0 \cdot t\_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{\left|1 - \mathsf{fma}\left(t\_0, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right|}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi1) (cos phi2)))
        (t_1 (sin (/ (- lambda1 lambda2) 2.0))))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (+ (* t_1 (* t_0 t_1)) (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
      (sqrt
       (fabs
        (-
         1.0
         (fma
          t_0
          (+ 0.5 (* -0.5 (cos (- lambda1 lambda2))))
          (pow (sin (* 0.5 (- phi1 phi2))) 2.0))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * cos(phi2);
	double t_1 = sin(((lambda1 - lambda2) / 2.0));
	return R * (2.0 * atan2(sqrt(((t_1 * (t_0 * t_1)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt(fabs((1.0 - fma(t_0, (0.5 + (-0.5 * cos((lambda1 - lambda2)))), pow(sin((0.5 * (phi1 - phi2))), 2.0)))))));
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * cos(phi2))
	t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_1 * Float64(t_0 * t_1)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(abs(Float64(1.0 - fma(t_0, Float64(0.5 + Float64(-0.5 * cos(Float64(lambda1 - lambda2)))), (sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0))))))))
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$1 * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[Abs[N[(1.0 - N[(t$95$0 * N[(0.5 + N[(-0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 \cdot \left(t\_0 \cdot t\_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{\left|1 - \mathsf{fma}\left(t\_0, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right|}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Applied egg-rr65.0%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\left({\left(1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)}^{2}\right)}^{0.5}}}}\right) \]
  4. Step-by-step derivation
    1. unpow1/265.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\sqrt{{\left(1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)}^{2}}}}}\right) \]
    2. unpow265.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\sqrt{\color{blue}{\left(1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right) \cdot \left(1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)}}}}\right) \]
    3. rem-sqrt-square65.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left|1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right|}}}\right) \]
    4. *-commutative65.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left|1 - \mathsf{fma}\left(\color{blue}{\cos \phi_2 \cdot \cos \phi_1}, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right|}}\right) \]
    5. cancel-sign-sub-inv65.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left|1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, \color{blue}{0.5 + \left(-0.5\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}, {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right|}}\right) \]
    6. metadata-eval65.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left|1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + \color{blue}{-0.5} \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right|}}\right) \]
    7. *-commutative65.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left|1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}^{2}\right)\right|}}\right) \]
  5. Simplified65.0%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left|1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right|}}}\right) \]
  6. Final simplification65.0%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{\left|1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right|}}\right) \]
  7. Add Preprocessing

Alternative 10: 47.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
t_1 := {t\_0}^{2}\\
t_2 := \cos \phi_1 \cdot \cos \phi_2\\
t_3 := \sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(t\_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}\\
t_4 := \cos \phi_1 \cdot t\_1\\
\mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_3}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - t\_4}}\right)\\

\mathbf{elif}\;\phi_1 \leq -2.25 \cdot 10^{-187}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_3}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot t\_1}}\right)\\

\mathbf{elif}\;\phi_1 \leq 1.56:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), t\_0 \cdot \sqrt{t\_2}\right)}{\sqrt{1 - \mathsf{fma}\left(t\_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_3}{\sqrt{1 - \left(t\_4 + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if phi1 < -2.5e15

    1. Initial program 51.1%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 47.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in phi2 around 0 48.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. +-commutative52.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+52.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow252.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(0.5 \cdot \phi_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin52.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(0.5 \cdot \phi_1\right) \cdot \cos \left(0.5 \cdot \phi_1\right)} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow252.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(0.5 \cdot \phi_1\right)}^{2}} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      6. *-commutative52.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \color{blue}{{\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1}}}\right) \]
    6. Simplified49.0%

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

    if -2.5e15 < phi1 < -2.2499999999999999e-187

    1. Initial program 84.8%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 61.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in phi1 around 0 61.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. +-commutative85.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+85.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow285.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin85.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow285.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2}} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    6. Simplified61.8%

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

    if -2.2499999999999999e-187 < phi1 < 1.5600000000000001

    1. Initial program 80.2%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Step-by-step derivation
      1. associate-*r*80.2%

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

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
    3. Simplified80.3%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr66.2%

      \[\leadsto \color{blue}{\left(1 \cdot \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}\right)} \cdot \left(R \cdot 2\right) \]
    6. Step-by-step derivation
      1. *-lft-identity66.2%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
      2. *-commutative66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \color{blue}{\left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}, \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. *-commutative66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \color{blue}{\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. *-commutative66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)} \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. *-commutative66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\color{blue}{\cos \phi_2 \cdot \cos \phi_1}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    7. Simplified66.2%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
    8. Step-by-step derivation
      1. flip--55.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\phi_1 + \phi_2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      2. div-inv54.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left(\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. pow254.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left(\color{blue}{{\phi_1}^{2}} - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. pow254.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - \color{blue}{{\phi_2}^{2}}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    9. Applied egg-rr54.3%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    10. Step-by-step derivation
      1. +-commutative54.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\color{blue}{\phi_2 + \phi_1}}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    11. Simplified54.3%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    12. Step-by-step derivation
      1. *-commutative54.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right) \cdot 0.5\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      2. un-div-inv55.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\frac{{\phi_1}^{2} - {\phi_2}^{2}}{\phi_2 + \phi_1}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. unpow255.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\color{blue}{\phi_1 \cdot \phi_1} - {\phi_2}^{2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. unpow255.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \color{blue}{\phi_2 \cdot \phi_2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. +-commutative55.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\color{blue}{\phi_1 + \phi_2}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      6. flip--66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\left(\phi_1 - \phi_2\right)} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      7. metadata-eval66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{\frac{1}{2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      8. div-inv66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\frac{\phi_1 - \phi_2}{2}\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      9. unpow266.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}} \cdot \left(R \cdot 2\right) \]
      10. sin-mult66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    13. Applied egg-rr66.2%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right) - \cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    14. Step-by-step derivation
      1. div-sub66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
      2. +-inverses66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. cos-066.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\color{blue}{1}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. metadata-eval66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{0.5} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. distribute-rgt-out66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      6. metadata-eval66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      7. *-rgt-identity66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    15. Simplified66.2%

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

    if 1.5600000000000001 < phi1

    1. Initial program 46.3%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 34.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in phi2 around 0 34.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
  3. Recombined 4 regimes into one program.
  4. Final simplification52.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{elif}\;\phi_1 \leq -2.25 \cdot 10^{-187}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{elif}\;\phi_1 \leq 1.56:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 47.5% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(t\_0 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}\\
t_2 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
t_3 := {t\_2}^{2}\\
t_4 := R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot t\_3}}\right)\\
\mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;t\_4\\

\mathbf{elif}\;\phi_1 \leq -1.02 \cdot 10^{-182}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot t\_3}}\right)\\

\mathbf{elif}\;\phi_1 \leq 0.7:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), t\_2 \cdot \sqrt{t\_0}\right)}{\sqrt{1 - \mathsf{fma}\left(t\_0, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\

\mathbf{else}:\\
\;\;\;\;t\_4\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi1 < -2.5e15 or 0.69999999999999996 < phi1

    1. Initial program 48.5%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 40.1%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in phi2 around 0 41.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. +-commutative49.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+49.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow249.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(0.5 \cdot \phi_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin49.6%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(0.5 \cdot \phi_1\right) \cdot \cos \left(0.5 \cdot \phi_1\right)} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow249.6%

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

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

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

    if -2.5e15 < phi1 < -1.02e-182

    1. Initial program 84.8%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 61.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in phi1 around 0 61.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. +-commutative85.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+85.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow285.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin85.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow285.0%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2}} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    6. Simplified61.8%

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

    if -1.02e-182 < phi1 < 0.69999999999999996

    1. Initial program 80.2%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Step-by-step derivation
      1. associate-*r*80.2%

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

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
    3. Simplified80.3%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr66.2%

      \[\leadsto \color{blue}{\left(1 \cdot \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}\right)} \cdot \left(R \cdot 2\right) \]
    6. Step-by-step derivation
      1. *-lft-identity66.2%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
      2. *-commutative66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \color{blue}{\left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}, \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. *-commutative66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \color{blue}{\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. *-commutative66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)} \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. *-commutative66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\color{blue}{\cos \phi_2 \cdot \cos \phi_1}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    7. Simplified66.2%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
    8. Step-by-step derivation
      1. flip--55.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\phi_1 + \phi_2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      2. div-inv54.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left(\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. pow254.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left(\color{blue}{{\phi_1}^{2}} - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. pow254.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - \color{blue}{{\phi_2}^{2}}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    9. Applied egg-rr54.3%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    10. Step-by-step derivation
      1. +-commutative54.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\color{blue}{\phi_2 + \phi_1}}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    11. Simplified54.3%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    12. Step-by-step derivation
      1. *-commutative54.3%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right) \cdot 0.5\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      2. un-div-inv55.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\frac{{\phi_1}^{2} - {\phi_2}^{2}}{\phi_2 + \phi_1}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. unpow255.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\color{blue}{\phi_1 \cdot \phi_1} - {\phi_2}^{2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. unpow255.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \color{blue}{\phi_2 \cdot \phi_2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. +-commutative55.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\color{blue}{\phi_1 + \phi_2}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      6. flip--66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\left(\phi_1 - \phi_2\right)} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      7. metadata-eval66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{\frac{1}{2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      8. div-inv66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\frac{\phi_1 - \phi_2}{2}\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      9. unpow266.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}} \cdot \left(R \cdot 2\right) \]
      10. sin-mult66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    13. Applied egg-rr66.2%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right) - \cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    14. Step-by-step derivation
      1. div-sub66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
      2. +-inverses66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. cos-066.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\color{blue}{1}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. metadata-eval66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{0.5} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. distribute-rgt-out66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      6. metadata-eval66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      7. *-rgt-identity66.2%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    15. Simplified66.2%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification52.6%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{elif}\;\phi_1 \leq -1.02 \cdot 10^{-182}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{elif}\;\phi_1 \leq 0.7:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 12: 61.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 + \left(\left(\frac{\cos \left(\phi_1 - \phi_2\right)}{2} - 0.5\right) - t\_1\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_1 (* t_0 (* (* (cos phi1) (cos phi2)) t_0))))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (+ t_1 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
      (sqrt (+ 1.0 (- (- (/ (cos (- phi1 phi2)) 2.0) 0.5) t_1))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(((lambda1 - lambda2) / 2.0));
	double t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
	return R * (2.0 * atan2(sqrt((t_1 + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt((1.0 + (((cos((phi1 - phi2)) / 2.0) - 0.5) - t_1)))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    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
    t_0 = sin(((lambda1 - lambda2) / 2.0d0))
    t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0)
    code = r * (2.0d0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt((1.0d0 + (((cos((phi1 - phi2)) / 2.0d0) - 0.5d0) - t_1)))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
	double t_1 = t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0);
	return R * (2.0 * Math.atan2(Math.sqrt((t_1 + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt((1.0 + (((Math.cos((phi1 - phi2)) / 2.0) - 0.5) - t_1)))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
	t_1 = t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0)
	return R * (2.0 * math.atan2(math.sqrt((t_1 + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt((1.0 + (((math.cos((phi1 - phi2)) / 2.0) - 0.5) - t_1)))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_1 = Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0))
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(1.0 + Float64(Float64(Float64(cos(Float64(phi1 - phi2)) / 2.0) - 0.5) - t_1))))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(((lambda1 - lambda2) / 2.0));
	t_1 = t_0 * ((cos(phi1) * cos(phi2)) * t_0);
	tmp = R * (2.0 * atan2(sqrt((t_1 + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt((1.0 + (((cos((phi1 - phi2)) / 2.0) - 0.5) - t_1)))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 + N[(N[(N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision] - 0.5), $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{1 + \left(\left(\frac{\cos \left(\phi_1 - \phi_2\right)}{2} - 0.5\right) - t\_1\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. unpow264.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-mult64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\color{blue}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr64.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. div-sub64.5%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right) + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. cos-064.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right) + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right) + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-lft-out64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right) + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right) + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. *-rgt-identity64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right) + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Simplified64.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Final simplification64.5%

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

Alternative 13: 61.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \sqrt{t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}\\ t_2 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\ \mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15} \lor \neg \left(\phi_1 \leq 8 \cdot 10^{-12}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot t\_2}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot t\_2}}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_1
         (sqrt
          (+
           (* t_0 (* (* (cos phi1) (cos phi2)) t_0))
           (pow (sin (/ (- phi1 phi2) 2.0)) 2.0))))
        (t_2 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))
   (if (or (<= phi1 -2.5e+15) (not (<= phi1 8e-12)))
     (*
      R
      (*
       2.0
       (atan2 t_1 (sqrt (- (pow (cos (* 0.5 phi1)) 2.0) (* (cos phi1) t_2))))))
     (*
      R
      (*
       2.0
       (atan2
        t_1
        (sqrt (- (pow (cos (* -0.5 phi2)) 2.0) (* (cos phi2) t_2)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(((lambda1 - lambda2) / 2.0));
	double t_1 = sqrt(((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0)));
	double t_2 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
	double tmp;
	if ((phi1 <= -2.5e+15) || !(phi1 <= 8e-12)) {
		tmp = R * (2.0 * atan2(t_1, sqrt((pow(cos((0.5 * phi1)), 2.0) - (cos(phi1) * t_2)))));
	} else {
		tmp = R * (2.0 * atan2(t_1, sqrt((pow(cos((-0.5 * phi2)), 2.0) - (cos(phi2) * t_2)))));
	}
	return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    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(((lambda1 - lambda2) / 2.0d0))
    t_1 = sqrt(((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0)))
    t_2 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
    if ((phi1 <= (-2.5d+15)) .or. (.not. (phi1 <= 8d-12))) then
        tmp = r * (2.0d0 * atan2(t_1, sqrt(((cos((0.5d0 * phi1)) ** 2.0d0) - (cos(phi1) * t_2)))))
    else
        tmp = r * (2.0d0 * atan2(t_1, sqrt(((cos(((-0.5d0) * phi2)) ** 2.0d0) - (cos(phi2) * t_2)))))
    end if
    code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
	double t_1 = Math.sqrt(((t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0)) + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0)));
	double t_2 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
	double tmp;
	if ((phi1 <= -2.5e+15) || !(phi1 <= 8e-12)) {
		tmp = R * (2.0 * Math.atan2(t_1, Math.sqrt((Math.pow(Math.cos((0.5 * phi1)), 2.0) - (Math.cos(phi1) * t_2)))));
	} else {
		tmp = R * (2.0 * Math.atan2(t_1, Math.sqrt((Math.pow(Math.cos((-0.5 * phi2)), 2.0) - (Math.cos(phi2) * t_2)))));
	}
	return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
	t_1 = math.sqrt(((t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0)) + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0)))
	t_2 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0)
	tmp = 0
	if (phi1 <= -2.5e+15) or not (phi1 <= 8e-12):
		tmp = R * (2.0 * math.atan2(t_1, math.sqrt((math.pow(math.cos((0.5 * phi1)), 2.0) - (math.cos(phi1) * t_2)))))
	else:
		tmp = R * (2.0 * math.atan2(t_1, math.sqrt((math.pow(math.cos((-0.5 * phi2)), 2.0) - (math.cos(phi2) * t_2)))))
	return tmp
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_1 = sqrt(Float64(Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0)))
	t_2 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0
	tmp = 0.0
	if ((phi1 <= -2.5e+15) || !(phi1 <= 8e-12))
		tmp = Float64(R * Float64(2.0 * atan(t_1, sqrt(Float64((cos(Float64(0.5 * phi1)) ^ 2.0) - Float64(cos(phi1) * t_2))))));
	else
		tmp = Float64(R * Float64(2.0 * atan(t_1, sqrt(Float64((cos(Float64(-0.5 * phi2)) ^ 2.0) - Float64(cos(phi2) * t_2))))));
	end
	return tmp
end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(((lambda1 - lambda2) / 2.0));
	t_1 = sqrt(((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (sin(((phi1 - phi2) / 2.0)) ^ 2.0)));
	t_2 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0;
	tmp = 0.0;
	if ((phi1 <= -2.5e+15) || ~((phi1 <= 8e-12)))
		tmp = R * (2.0 * atan2(t_1, sqrt(((cos((0.5 * phi1)) ^ 2.0) - (cos(phi1) * t_2)))));
	else
		tmp = R * (2.0 * atan2(t_1, sqrt(((cos((-0.5 * phi2)) ^ 2.0) - (cos(phi2) * t_2)))));
	end
	tmp_2 = tmp;
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, If[Or[LessEqual[phi1, -2.5e+15], N[Not[LessEqual[phi1, 8e-12]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[t$95$1 / N[Sqrt[N[(N[Power[N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - N[(N[Cos[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$1 / N[Sqrt[N[(N[Power[N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := \sqrt{t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}\\
t_2 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
\mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15} \lor \neg \left(\phi_1 \leq 8 \cdot 10^{-12}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot t\_2}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot t\_2}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi1 < -2.5e15 or 7.99999999999999984e-12 < phi1

    1. Initial program 48.3%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in phi2 around 0 49.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
    4. Step-by-step derivation
      1. +-commutative49.3%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+49.3%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(0.5 \cdot \phi_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin49.4%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(0.5 \cdot \phi_1\right) \cdot \cos \left(0.5 \cdot \phi_1\right)} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow249.4%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(0.5 \cdot \phi_1\right)}^{2}} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      6. *-commutative49.4%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \color{blue}{{\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1}}}\right) \]
    5. Simplified49.4%

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

    if -2.5e15 < phi1 < 7.99999999999999984e-12

    1. Initial program 82.2%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in phi1 around 0 82.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    4. Step-by-step derivation
      1. +-commutative82.3%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+82.3%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin82.3%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow282.3%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2}} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    5. Simplified82.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification65.0%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15} \lor \neg \left(\phi_1 \leq 8 \cdot 10^{-12}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 14: 57.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_1 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\ t_2 := \cos \phi_1 \cdot t\_1\\ t_3 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_4 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_3\\ t_5 := \sqrt{t\_0 + t\_4 \cdot \sin \left(0.5 \cdot \lambda_1\right)}\\ \mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_5}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - t\_2}}\right)\\ \mathbf{elif}\;\phi_1 \leq 0.000145:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_3 \cdot t\_4 + t\_0}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot t\_1}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_5}{\sqrt{1 - \left(t\_2 + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0))
        (t_1 (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0))
        (t_2 (* (cos phi1) t_1))
        (t_3 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_4 (* (* (cos phi1) (cos phi2)) t_3))
        (t_5 (sqrt (+ t_0 (* t_4 (sin (* 0.5 lambda1)))))))
   (if (<= phi1 -2.5e+15)
     (* R (* 2.0 (atan2 t_5 (sqrt (- (pow (cos (* 0.5 phi1)) 2.0) t_2)))))
     (if (<= phi1 0.000145)
       (*
        R
        (*
         2.0
         (atan2
          (sqrt (+ (* t_3 t_4) t_0))
          (sqrt (- (pow (cos (* -0.5 phi2)) 2.0) (* (cos phi2) t_1))))))
       (*
        R
        (*
         2.0
         (atan2 t_5 (sqrt (- 1.0 (+ t_2 (pow (sin (* 0.5 phi1)) 2.0)))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = pow(sin(((phi1 - phi2) / 2.0)), 2.0);
	double t_1 = pow(sin((0.5 * (lambda1 - lambda2))), 2.0);
	double t_2 = cos(phi1) * t_1;
	double t_3 = sin(((lambda1 - lambda2) / 2.0));
	double t_4 = (cos(phi1) * cos(phi2)) * t_3;
	double t_5 = sqrt((t_0 + (t_4 * sin((0.5 * lambda1)))));
	double tmp;
	if (phi1 <= -2.5e+15) {
		tmp = R * (2.0 * atan2(t_5, sqrt((pow(cos((0.5 * phi1)), 2.0) - t_2))));
	} else if (phi1 <= 0.000145) {
		tmp = R * (2.0 * atan2(sqrt(((t_3 * t_4) + t_0)), sqrt((pow(cos((-0.5 * phi2)), 2.0) - (cos(phi2) * t_1)))));
	} else {
		tmp = R * (2.0 * atan2(t_5, sqrt((1.0 - (t_2 + pow(sin((0.5 * phi1)), 2.0))))));
	}
	return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    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) :: t_3
    real(8) :: t_4
    real(8) :: t_5
    real(8) :: tmp
    t_0 = sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0
    t_1 = sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0
    t_2 = cos(phi1) * t_1
    t_3 = sin(((lambda1 - lambda2) / 2.0d0))
    t_4 = (cos(phi1) * cos(phi2)) * t_3
    t_5 = sqrt((t_0 + (t_4 * sin((0.5d0 * lambda1)))))
    if (phi1 <= (-2.5d+15)) then
        tmp = r * (2.0d0 * atan2(t_5, sqrt(((cos((0.5d0 * phi1)) ** 2.0d0) - t_2))))
    else if (phi1 <= 0.000145d0) then
        tmp = r * (2.0d0 * atan2(sqrt(((t_3 * t_4) + t_0)), sqrt(((cos(((-0.5d0) * phi2)) ** 2.0d0) - (cos(phi2) * t_1)))))
    else
        tmp = r * (2.0d0 * atan2(t_5, sqrt((1.0d0 - (t_2 + (sin((0.5d0 * phi1)) ** 2.0d0))))))
    end if
    code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0);
	double t_1 = Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0);
	double t_2 = Math.cos(phi1) * t_1;
	double t_3 = Math.sin(((lambda1 - lambda2) / 2.0));
	double t_4 = (Math.cos(phi1) * Math.cos(phi2)) * t_3;
	double t_5 = Math.sqrt((t_0 + (t_4 * Math.sin((0.5 * lambda1)))));
	double tmp;
	if (phi1 <= -2.5e+15) {
		tmp = R * (2.0 * Math.atan2(t_5, Math.sqrt((Math.pow(Math.cos((0.5 * phi1)), 2.0) - t_2))));
	} else if (phi1 <= 0.000145) {
		tmp = R * (2.0 * Math.atan2(Math.sqrt(((t_3 * t_4) + t_0)), Math.sqrt((Math.pow(Math.cos((-0.5 * phi2)), 2.0) - (Math.cos(phi2) * t_1)))));
	} else {
		tmp = R * (2.0 * Math.atan2(t_5, Math.sqrt((1.0 - (t_2 + Math.pow(Math.sin((0.5 * phi1)), 2.0))))));
	}
	return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0)
	t_1 = math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0)
	t_2 = math.cos(phi1) * t_1
	t_3 = math.sin(((lambda1 - lambda2) / 2.0))
	t_4 = (math.cos(phi1) * math.cos(phi2)) * t_3
	t_5 = math.sqrt((t_0 + (t_4 * math.sin((0.5 * lambda1)))))
	tmp = 0
	if phi1 <= -2.5e+15:
		tmp = R * (2.0 * math.atan2(t_5, math.sqrt((math.pow(math.cos((0.5 * phi1)), 2.0) - t_2))))
	elif phi1 <= 0.000145:
		tmp = R * (2.0 * math.atan2(math.sqrt(((t_3 * t_4) + t_0)), math.sqrt((math.pow(math.cos((-0.5 * phi2)), 2.0) - (math.cos(phi2) * t_1)))))
	else:
		tmp = R * (2.0 * math.atan2(t_5, math.sqrt((1.0 - (t_2 + math.pow(math.sin((0.5 * phi1)), 2.0))))))
	return tmp
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0
	t_1 = sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0
	t_2 = Float64(cos(phi1) * t_1)
	t_3 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_4 = Float64(Float64(cos(phi1) * cos(phi2)) * t_3)
	t_5 = sqrt(Float64(t_0 + Float64(t_4 * sin(Float64(0.5 * lambda1)))))
	tmp = 0.0
	if (phi1 <= -2.5e+15)
		tmp = Float64(R * Float64(2.0 * atan(t_5, sqrt(Float64((cos(Float64(0.5 * phi1)) ^ 2.0) - t_2)))));
	elseif (phi1 <= 0.000145)
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_3 * t_4) + t_0)), sqrt(Float64((cos(Float64(-0.5 * phi2)) ^ 2.0) - Float64(cos(phi2) * t_1))))));
	else
		tmp = Float64(R * Float64(2.0 * atan(t_5, sqrt(Float64(1.0 - Float64(t_2 + (sin(Float64(0.5 * phi1)) ^ 2.0)))))));
	end
	return tmp
end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(((phi1 - phi2) / 2.0)) ^ 2.0;
	t_1 = sin((0.5 * (lambda1 - lambda2))) ^ 2.0;
	t_2 = cos(phi1) * t_1;
	t_3 = sin(((lambda1 - lambda2) / 2.0));
	t_4 = (cos(phi1) * cos(phi2)) * t_3;
	t_5 = sqrt((t_0 + (t_4 * sin((0.5 * lambda1)))));
	tmp = 0.0;
	if (phi1 <= -2.5e+15)
		tmp = R * (2.0 * atan2(t_5, sqrt(((cos((0.5 * phi1)) ^ 2.0) - t_2))));
	elseif (phi1 <= 0.000145)
		tmp = R * (2.0 * atan2(sqrt(((t_3 * t_4) + t_0)), sqrt(((cos((-0.5 * phi2)) ^ 2.0) - (cos(phi2) * t_1)))));
	else
		tmp = R * (2.0 * atan2(t_5, sqrt((1.0 - (t_2 + (sin((0.5 * phi1)) ^ 2.0))))));
	end
	tmp_2 = tmp;
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[Sqrt[N[(t$95$0 + N[(t$95$4 * N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -2.5e+15], N[(R * N[(2.0 * N[ArcTan[t$95$5 / N[Sqrt[N[(N[Power[N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - t$95$2), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 0.000145], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$3 * t$95$4), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$5 / N[Sqrt[N[(1.0 - N[(t$95$2 + N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
t_1 := {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\\
t_2 := \cos \phi_1 \cdot t\_1\\
t_3 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_4 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_3\\
t_5 := \sqrt{t\_0 + t\_4 \cdot \sin \left(0.5 \cdot \lambda_1\right)}\\
\mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_5}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - t\_2}}\right)\\

\mathbf{elif}\;\phi_1 \leq 0.000145:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_3 \cdot t\_4 + t\_0}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot t\_1}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_5}{\sqrt{1 - \left(t\_2 + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if phi1 < -2.5e15

    1. Initial program 51.1%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 47.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in phi2 around 0 48.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. +-commutative52.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+52.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow252.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(0.5 \cdot \phi_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin52.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(0.5 \cdot \phi_1\right) \cdot \cos \left(0.5 \cdot \phi_1\right)} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow252.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(0.5 \cdot \phi_1\right)}^{2}} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      6. *-commutative52.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \color{blue}{{\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1}}}\right) \]
    6. Simplified49.0%

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

    if -2.5e15 < phi1 < 1.45e-4

    1. Initial program 81.7%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in phi1 around 0 81.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    4. Step-by-step derivation
      1. +-commutative81.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+81.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow281.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin81.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow281.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2}} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    5. Simplified81.7%

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

    if 1.45e-4 < phi1

    1. Initial program 46.3%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 34.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in phi2 around 0 34.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification60.7%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+15}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{elif}\;\phi_1 \leq 0.000145:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 15: 47.4% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\ \mathbf{if}\;\phi_2 \leq -15000000000000 \lor \neg \left(\phi_2 \leq 1.55 \cdot 10^{+34}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(t\_0 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {t\_1}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), t\_1 \cdot \sqrt{t\_0}\right)}{\sqrt{1 - \mathsf{fma}\left(t\_0, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi1) (cos phi2)))
        (t_1 (sin (* 0.5 (- lambda1 lambda2)))))
   (if (or (<= phi2 -15000000000000.0) (not (<= phi2 1.55e+34)))
     (*
      R
      (*
       2.0
       (atan2
        (sqrt
         (+
          (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
          (* (* t_0 (sin (/ (- lambda1 lambda2) 2.0))) (sin (* 0.5 lambda1)))))
        (sqrt
         (- (pow (cos (* -0.5 phi2)) 2.0) (* (cos phi2) (pow t_1 2.0)))))))
     (*
      (atan2
       (hypot (sin (* 0.5 (- phi1 phi2))) (* t_1 (sqrt t_0)))
       (sqrt
        (-
         1.0
         (fma
          t_0
          (+ 0.5 (* -0.5 (cos (- lambda1 lambda2))))
          (- 0.5 (/ (cos (- phi1 phi2)) 2.0))))))
      (* R 2.0)))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * cos(phi2);
	double t_1 = sin((0.5 * (lambda1 - lambda2)));
	double tmp;
	if ((phi2 <= -15000000000000.0) || !(phi2 <= 1.55e+34)) {
		tmp = R * (2.0 * atan2(sqrt((pow(sin(((phi1 - phi2) / 2.0)), 2.0) + ((t_0 * sin(((lambda1 - lambda2) / 2.0))) * sin((0.5 * lambda1))))), sqrt((pow(cos((-0.5 * phi2)), 2.0) - (cos(phi2) * pow(t_1, 2.0))))));
	} else {
		tmp = atan2(hypot(sin((0.5 * (phi1 - phi2))), (t_1 * sqrt(t_0))), sqrt((1.0 - fma(t_0, (0.5 + (-0.5 * cos((lambda1 - lambda2)))), (0.5 - (cos((phi1 - phi2)) / 2.0)))))) * (R * 2.0);
	}
	return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * cos(phi2))
	t_1 = sin(Float64(0.5 * Float64(lambda1 - lambda2)))
	tmp = 0.0
	if ((phi2 <= -15000000000000.0) || !(phi2 <= 1.55e+34))
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(t_0 * sin(Float64(Float64(lambda1 - lambda2) / 2.0))) * sin(Float64(0.5 * lambda1))))), sqrt(Float64((cos(Float64(-0.5 * phi2)) ^ 2.0) - Float64(cos(phi2) * (t_1 ^ 2.0)))))));
	else
		tmp = Float64(atan(hypot(sin(Float64(0.5 * Float64(phi1 - phi2))), Float64(t_1 * sqrt(t_0))), sqrt(Float64(1.0 - fma(t_0, Float64(0.5 + Float64(-0.5 * cos(Float64(lambda1 - lambda2)))), Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)))))) * Float64(R * 2.0));
	end
	return tmp
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[phi2, -15000000000000.0], N[Not[LessEqual[phi2, 1.55e+34]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(t$95$0 * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Cos[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - N[(N[Cos[phi2], $MachinePrecision] * N[Power[t$95$1, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[Sqrt[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2 + N[(t$95$1 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$0 * N[(0.5 + N[(-0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(R * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
\mathbf{if}\;\phi_2 \leq -15000000000000 \lor \neg \left(\phi_2 \leq 1.55 \cdot 10^{+34}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(t\_0 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {t\_1}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), t\_1 \cdot \sqrt{t\_0}\right)}{\sqrt{1 - \mathsf{fma}\left(t\_0, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi2 < -1.5e13 or 1.54999999999999989e34 < phi2

    1. Initial program 49.7%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 39.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in phi1 around 0 40.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. +-commutative50.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+50.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow250.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin50.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow250.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2}} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    6. Simplified40.7%

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

    if -1.5e13 < phi2 < 1.54999999999999989e34

    1. Initial program 77.9%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Step-by-step derivation
      1. associate-*r*77.9%

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

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
    3. Simplified77.9%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr55.1%

      \[\leadsto \color{blue}{\left(1 \cdot \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}\right)} \cdot \left(R \cdot 2\right) \]
    6. Step-by-step derivation
      1. *-lft-identity55.1%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
      2. *-commutative55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \color{blue}{\left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}, \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. *-commutative55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \color{blue}{\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. *-commutative55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)} \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. *-commutative55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\color{blue}{\cos \phi_2 \cdot \cos \phi_1}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    7. Simplified55.1%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
    8. Step-by-step derivation
      1. flip--45.4%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\phi_1 + \phi_2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      2. div-inv44.5%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left(\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. pow244.5%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left(\color{blue}{{\phi_1}^{2}} - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. pow244.5%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - \color{blue}{{\phi_2}^{2}}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    9. Applied egg-rr44.5%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    10. Step-by-step derivation
      1. +-commutative44.5%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\color{blue}{\phi_2 + \phi_1}}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    11. Simplified44.5%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    12. Step-by-step derivation
      1. *-commutative44.5%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right) \cdot 0.5\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      2. un-div-inv45.4%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\frac{{\phi_1}^{2} - {\phi_2}^{2}}{\phi_2 + \phi_1}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. unpow245.4%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\color{blue}{\phi_1 \cdot \phi_1} - {\phi_2}^{2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. unpow245.4%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \color{blue}{\phi_2 \cdot \phi_2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. +-commutative45.4%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\color{blue}{\phi_1 + \phi_2}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      6. flip--55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\left(\phi_1 - \phi_2\right)} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      7. metadata-eval55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{\frac{1}{2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      8. div-inv55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\frac{\phi_1 - \phi_2}{2}\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      9. unpow255.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}} \cdot \left(R \cdot 2\right) \]
      10. sin-mult55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    13. Applied egg-rr55.1%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right) - \cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    14. Step-by-step derivation
      1. div-sub55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
      2. +-inverses55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. cos-055.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\color{blue}{1}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. metadata-eval55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{0.5} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. distribute-rgt-out55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      6. metadata-eval55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      7. *-rgt-identity55.1%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    15. Simplified55.1%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification48.2%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -15000000000000 \lor \neg \left(\phi_2 \leq 1.55 \cdot 10^{+34}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 16: 61.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 \cdot \left(t\_0 \cdot t\_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{\left(1 - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right) + t\_0 \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi1) (cos phi2)))
        (t_1 (sin (/ (- lambda1 lambda2) 2.0))))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (+ (* t_1 (* t_0 t_1)) (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
      (sqrt
       (+
        (- 1.0 (pow (sin (* 0.5 (- phi1 phi2))) 2.0))
        (* t_0 (- (* 0.5 (cos (- lambda1 lambda2))) 0.5)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * cos(phi2);
	double t_1 = sin(((lambda1 - lambda2) / 2.0));
	return R * (2.0 * atan2(sqrt(((t_1 * (t_0 * t_1)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))), sqrt(((1.0 - pow(sin((0.5 * (phi1 - phi2))), 2.0)) + (t_0 * ((0.5 * cos((lambda1 - lambda2))) - 0.5))))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    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
    t_0 = cos(phi1) * cos(phi2)
    t_1 = sin(((lambda1 - lambda2) / 2.0d0))
    code = r * (2.0d0 * atan2(sqrt(((t_1 * (t_0 * t_1)) + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))), sqrt(((1.0d0 - (sin((0.5d0 * (phi1 - phi2))) ** 2.0d0)) + (t_0 * ((0.5d0 * cos((lambda1 - lambda2))) - 0.5d0))))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.cos(phi1) * Math.cos(phi2);
	double t_1 = Math.sin(((lambda1 - lambda2) / 2.0));
	return R * (2.0 * Math.atan2(Math.sqrt(((t_1 * (t_0 * t_1)) + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))), Math.sqrt(((1.0 - Math.pow(Math.sin((0.5 * (phi1 - phi2))), 2.0)) + (t_0 * ((0.5 * Math.cos((lambda1 - lambda2))) - 0.5))))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.cos(phi1) * math.cos(phi2)
	t_1 = math.sin(((lambda1 - lambda2) / 2.0))
	return R * (2.0 * math.atan2(math.sqrt(((t_1 * (t_0 * t_1)) + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))), math.sqrt(((1.0 - math.pow(math.sin((0.5 * (phi1 - phi2))), 2.0)) + (t_0 * ((0.5 * math.cos((lambda1 - lambda2))) - 0.5))))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * cos(phi2))
	t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(t_1 * Float64(t_0 * t_1)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(Float64(Float64(1.0 - (sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0)) + Float64(t_0 * Float64(Float64(0.5 * cos(Float64(lambda1 - lambda2))) - 0.5)))))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = cos(phi1) * cos(phi2);
	t_1 = sin(((lambda1 - lambda2) / 2.0));
	tmp = R * (2.0 * atan2(sqrt(((t_1 * (t_0 * t_1)) + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))), sqrt(((1.0 - (sin((0.5 * (phi1 - phi2))) ^ 2.0)) + (t_0 * ((0.5 * cos((lambda1 - lambda2))) - 0.5))))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(t$95$1 * N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + N[(t$95$0 * N[(N[(0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 \cdot \left(t\_0 \cdot t\_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}{\sqrt{\left(1 - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right) + t\_0 \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. associate--r+64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}}\right) \]
    2. associate-*l*64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \color{blue}{\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}}\right) \]
    3. cancel-sign-sub-inv64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}}\right) \]
    4. div-inv64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - {\sin \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. metadata-eval64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. sqr-sin-a64.5%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}\right)}}\right) \]
    8. cos-sum64.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \color{blue}{\cos \left(\frac{\lambda_1 - \lambda_2}{2} + \frac{\lambda_1 - \lambda_2}{2}\right)}\right)}}\right) \]
  4. Applied egg-rr64.5%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}}\right) \]
  5. Final simplification64.5%

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

Alternative 17: 43.5% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\ t_1 := \cos \phi_1 \cdot \cos \phi_2\\ \mathbf{if}\;\phi_1 \leq -400 \lor \neg \left(\phi_1 \leq 1.56\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1}{2}\right)}^{2} + \sin \left(0.5 \cdot \lambda_1\right) \cdot \left(t\_1 \cdot \sin \left(-0.5 \cdot \lambda_2\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot {t\_0}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), t\_0 \cdot \sqrt{t\_1}\right)}{\sqrt{1 - \mathsf{fma}\left(t\_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 (- lambda1 lambda2))))
        (t_1 (* (cos phi1) (cos phi2))))
   (if (or (<= phi1 -400.0) (not (<= phi1 1.56)))
     (*
      R
      (*
       2.0
       (atan2
        (sqrt
         (+
          (pow (sin (/ phi1 2.0)) 2.0)
          (* (sin (* 0.5 lambda1)) (* t_1 (sin (* -0.5 lambda2))))))
        (sqrt (- (pow (cos (* 0.5 phi1)) 2.0) (* (cos phi1) (pow t_0 2.0)))))))
     (*
      (atan2
       (hypot (sin (* 0.5 (- phi1 phi2))) (* t_0 (sqrt t_1)))
       (sqrt
        (-
         1.0
         (fma
          t_1
          (+ 0.5 (* -0.5 (cos (- lambda1 lambda2))))
          (- 0.5 (/ (cos (- phi1 phi2)) 2.0))))))
      (* R 2.0)))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((0.5 * (lambda1 - lambda2)));
	double t_1 = cos(phi1) * cos(phi2);
	double tmp;
	if ((phi1 <= -400.0) || !(phi1 <= 1.56)) {
		tmp = R * (2.0 * atan2(sqrt((pow(sin((phi1 / 2.0)), 2.0) + (sin((0.5 * lambda1)) * (t_1 * sin((-0.5 * lambda2)))))), sqrt((pow(cos((0.5 * phi1)), 2.0) - (cos(phi1) * pow(t_0, 2.0))))));
	} else {
		tmp = atan2(hypot(sin((0.5 * (phi1 - phi2))), (t_0 * sqrt(t_1))), sqrt((1.0 - fma(t_1, (0.5 + (-0.5 * cos((lambda1 - lambda2)))), (0.5 - (cos((phi1 - phi2)) / 2.0)))))) * (R * 2.0);
	}
	return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(0.5 * Float64(lambda1 - lambda2)))
	t_1 = Float64(cos(phi1) * cos(phi2))
	tmp = 0.0
	if ((phi1 <= -400.0) || !(phi1 <= 1.56))
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(Float64(phi1 / 2.0)) ^ 2.0) + Float64(sin(Float64(0.5 * lambda1)) * Float64(t_1 * sin(Float64(-0.5 * lambda2)))))), sqrt(Float64((cos(Float64(0.5 * phi1)) ^ 2.0) - Float64(cos(phi1) * (t_0 ^ 2.0)))))));
	else
		tmp = Float64(atan(hypot(sin(Float64(0.5 * Float64(phi1 - phi2))), Float64(t_0 * sqrt(t_1))), sqrt(Float64(1.0 - fma(t_1, Float64(0.5 + Float64(-0.5 * cos(Float64(lambda1 - lambda2)))), Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)))))) * Float64(R * 2.0));
	end
	return tmp
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[phi1, -400.0], N[Not[LessEqual[phi1, 1.56]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[Power[N[Sin[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision] * N[(t$95$1 * N[Sin[N[(-0.5 * lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - N[(N[Cos[phi1], $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[ArcTan[N[Sqrt[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2 + N[(t$95$0 * N[Sqrt[t$95$1], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$1 * N[(0.5 + N[(-0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(R * 2.0), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\\
t_1 := \cos \phi_1 \cdot \cos \phi_2\\
\mathbf{if}\;\phi_1 \leq -400 \lor \neg \left(\phi_1 \leq 1.56\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1}{2}\right)}^{2} + \sin \left(0.5 \cdot \lambda_1\right) \cdot \left(t\_1 \cdot \sin \left(-0.5 \cdot \lambda_2\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot {t\_0}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), t\_0 \cdot \sqrt{t\_1}\right)}{\sqrt{1 - \mathsf{fma}\left(t\_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi1 < -400 or 1.5600000000000001 < phi1

    1. Initial program 48.3%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 40.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in lambda1 around 0 28.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. Taylor expanded in phi1 around inf 28.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\color{blue}{\phi_1}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(-0.5 \cdot \lambda_2\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Taylor expanded in phi2 around 0 29.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(-0.5 \cdot \lambda_2\right)\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{\color{blue}{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
    7. Step-by-step derivation
      1. +-commutative49.3%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+49.3%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(0.5 \cdot \phi_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin49.4%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(0.5 \cdot \phi_1\right) \cdot \cos \left(0.5 \cdot \phi_1\right)} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow249.4%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(0.5 \cdot \phi_1\right)}^{2}} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      6. *-commutative49.4%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \color{blue}{{\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1}}}\right) \]
    8. Simplified29.4%

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

    if -400 < phi1 < 1.5600000000000001

    1. Initial program 82.2%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Step-by-step derivation
      1. associate-*r*82.2%

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

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
    3. Simplified82.2%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right)} \]
    4. Add Preprocessing
    5. Applied egg-rr61.9%

      \[\leadsto \color{blue}{\left(1 \cdot \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}\right)} \cdot \left(R \cdot 2\right) \]
    6. Step-by-step derivation
      1. *-lft-identity61.9%

        \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
      2. *-commutative61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \color{blue}{\left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}, \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. *-commutative61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \color{blue}{\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. *-commutative61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)} \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. *-commutative61.9%

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

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
    8. Step-by-step derivation
      1. flip--52.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\phi_1 + \phi_2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      2. div-inv51.7%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left(\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. pow251.7%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left(\color{blue}{{\phi_1}^{2}} - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. pow251.7%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - \color{blue}{{\phi_2}^{2}}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    9. Applied egg-rr51.7%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    10. Step-by-step derivation
      1. +-commutative51.7%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\color{blue}{\phi_2 + \phi_1}}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    11. Simplified51.7%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    12. Step-by-step derivation
      1. *-commutative51.7%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right) \cdot 0.5\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      2. un-div-inv52.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\frac{{\phi_1}^{2} - {\phi_2}^{2}}{\phi_2 + \phi_1}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. unpow252.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\color{blue}{\phi_1 \cdot \phi_1} - {\phi_2}^{2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. unpow252.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \color{blue}{\phi_2 \cdot \phi_2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. +-commutative52.6%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\color{blue}{\phi_1 + \phi_2}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      6. flip--61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\left(\phi_1 - \phi_2\right)} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      7. metadata-eval61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{\frac{1}{2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      8. div-inv61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\frac{\phi_1 - \phi_2}{2}\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
      9. unpow261.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}} \cdot \left(R \cdot 2\right) \]
      10. sin-mult61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    13. Applied egg-rr61.9%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right) - \cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    14. Step-by-step derivation
      1. div-sub61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
      2. +-inverses61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      3. cos-061.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\color{blue}{1}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      4. metadata-eval61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{0.5} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      5. distribute-rgt-out61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      6. metadata-eval61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
      7. *-rgt-identity61.9%

        \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    15. Simplified61.9%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -400 \lor \neg \left(\phi_1 \leq 1.56\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1}{2}\right)}^{2} + \sin \left(0.5 \cdot \lambda_1\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(-0.5 \cdot \lambda_2\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 18: 61.7% accurate, 1.1× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + t\_0}}{\sqrt{1 + \left(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right)\right) - t\_0\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (pow (sin (* 0.5 (- phi1 phi2))) 2.0)))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt
       (+
        (*
         (cos phi1)
         (* (cos phi2) (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)))
        t_0))
      (sqrt
       (+
        1.0
        (-
         (*
          (cos phi1)
          (* (cos phi2) (- (* 0.5 (cos (- lambda1 lambda2))) 0.5)))
         t_0))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = pow(sin((0.5 * (phi1 - phi2))), 2.0);
	return R * (2.0 * atan2(sqrt(((cos(phi1) * (cos(phi2) * pow(sin((0.5 * (lambda1 - lambda2))), 2.0))) + t_0)), sqrt((1.0 + ((cos(phi1) * (cos(phi2) * ((0.5 * cos((lambda1 - lambda2))) - 0.5))) - t_0)))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    t_0 = sin((0.5d0 * (phi1 - phi2))) ** 2.0d0
    code = r * (2.0d0 * atan2(sqrt(((cos(phi1) * (cos(phi2) * (sin((0.5d0 * (lambda1 - lambda2))) ** 2.0d0))) + t_0)), sqrt((1.0d0 + ((cos(phi1) * (cos(phi2) * ((0.5d0 * cos((lambda1 - lambda2))) - 0.5d0))) - t_0)))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.pow(Math.sin((0.5 * (phi1 - phi2))), 2.0);
	return R * (2.0 * Math.atan2(Math.sqrt(((Math.cos(phi1) * (Math.cos(phi2) * Math.pow(Math.sin((0.5 * (lambda1 - lambda2))), 2.0))) + t_0)), Math.sqrt((1.0 + ((Math.cos(phi1) * (Math.cos(phi2) * ((0.5 * Math.cos((lambda1 - lambda2))) - 0.5))) - t_0)))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.pow(math.sin((0.5 * (phi1 - phi2))), 2.0)
	return R * (2.0 * math.atan2(math.sqrt(((math.cos(phi1) * (math.cos(phi2) * math.pow(math.sin((0.5 * (lambda1 - lambda2))), 2.0))) + t_0)), math.sqrt((1.0 + ((math.cos(phi1) * (math.cos(phi2) * ((0.5 * math.cos((lambda1 - lambda2))) - 0.5))) - t_0)))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0
	return Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(cos(phi1) * Float64(cos(phi2) * (sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0))) + t_0)), sqrt(Float64(1.0 + Float64(Float64(cos(phi1) * Float64(cos(phi2) * Float64(Float64(0.5 * cos(Float64(lambda1 - lambda2))) - 0.5))) - t_0))))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin((0.5 * (phi1 - phi2))) ^ 2.0;
	tmp = R * (2.0 * atan2(sqrt(((cos(phi1) * (cos(phi2) * (sin((0.5 * (lambda1 - lambda2))) ^ 2.0))) + t_0)), sqrt((1.0 + ((cos(phi1) * (cos(phi2) * ((0.5 * cos((lambda1 - lambda2))) - 0.5))) - t_0)))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 + N[(N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[(N[(0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + t\_0}}{\sqrt{1 + \left(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right)\right) - t\_0\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Step-by-step derivation
    1. add-cbrt-cube63.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\sqrt[3]{\left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} \cdot {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) \cdot {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. pow363.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{\color{blue}{{\left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}^{3}}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. pow-pow63.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{\color{blue}{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{\left(2 \cdot 3\right)}}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. div-inv63.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}^{\left(2 \cdot 3\right)}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. metadata-eval63.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}^{\left(2 \cdot 3\right)}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval63.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{\color{blue}{6}}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Applied egg-rr63.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{6}}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Step-by-step derivation
    1. +-commutative63.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{6}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left(\left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}}\right) \]
    2. associate-*l*63.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{6}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left(\color{blue}{\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)} + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right) \]
    3. fma-undefine63.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{6}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}}\right) \]
    4. add-cube-cbrt63.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{6}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(\sqrt[3]{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)} \cdot \sqrt[3]{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}\right) \cdot \sqrt[3]{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}}}\right) \]
    5. pow363.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{6}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\left(\sqrt[3]{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}\right)}^{3}}}}\right) \]
  6. Applied egg-rr63.2%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\sqrt[3]{{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{6}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\left(\sqrt[3]{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}\right)}^{3}}}}\right) \]
  7. Taylor expanded in phi1 around 0 64.5%

    \[\leadsto R \cdot \color{blue}{\left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right) + {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}{\sqrt{1 - \left(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}\right)} \]
  8. Final simplification64.5%

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

Alternative 19: 40.5% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{t\_0}\right)}{\sqrt{1 - \mathsf{fma}\left(t\_0, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (* (cos phi1) (cos phi2))))
   (*
    (atan2
     (hypot
      (sin (* 0.5 (- phi1 phi2)))
      (* (sin (* 0.5 (- lambda1 lambda2))) (sqrt t_0)))
     (sqrt
      (-
       1.0
       (fma
        t_0
        (+ 0.5 (* -0.5 (cos (- lambda1 lambda2))))
        (- 0.5 (/ (cos (- phi1 phi2)) 2.0))))))
    (* R 2.0))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = cos(phi1) * cos(phi2);
	return atan2(hypot(sin((0.5 * (phi1 - phi2))), (sin((0.5 * (lambda1 - lambda2))) * sqrt(t_0))), sqrt((1.0 - fma(t_0, (0.5 + (-0.5 * cos((lambda1 - lambda2)))), (0.5 - (cos((phi1 - phi2)) / 2.0)))))) * (R * 2.0);
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(cos(phi1) * cos(phi2))
	return Float64(atan(hypot(sin(Float64(0.5 * Float64(phi1 - phi2))), Float64(sin(Float64(0.5 * Float64(lambda1 - lambda2))) * sqrt(t_0))), sqrt(Float64(1.0 - fma(t_0, Float64(0.5 + Float64(-0.5 * cos(Float64(lambda1 - lambda2)))), Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)))))) * Float64(R * 2.0))
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, N[(N[ArcTan[N[Sqrt[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] ^ 2 + N[(N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$0 * N[(0.5 + N[(-0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * N[(R * 2.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{t\_0}\right)}{\sqrt{1 - \mathsf{fma}\left(t\_0, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Step-by-step derivation
    1. associate-*r*64.4%

      \[\leadsto \color{blue}{\left(R \cdot 2\right) \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}} \]
    2. *-commutative64.4%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(R \cdot 2\right)} \]
  3. Simplified64.5%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right)} \]
  4. Add Preprocessing
  5. Applied egg-rr39.8%

    \[\leadsto \color{blue}{\left(1 \cdot \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}\right)} \cdot \left(R \cdot 2\right) \]
  6. Step-by-step derivation
    1. *-lft-identity39.8%

      \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right), \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
    2. *-commutative39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \color{blue}{\left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}, \sqrt{\cos \phi_1 \cdot \cos \phi_2} \cdot \sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    3. *-commutative39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \color{blue}{\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    4. *-commutative39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)} \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    5. *-commutative39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\color{blue}{\cos \phi_2 \cdot \cos \phi_1}}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
  7. Simplified39.8%

    \[\leadsto \color{blue}{\tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}} \cdot \left(R \cdot 2\right) \]
  8. Step-by-step derivation
    1. flip--29.6%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\phi_1 + \phi_2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    2. div-inv28.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left(\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    3. pow228.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left(\color{blue}{{\phi_1}^{2}} - \phi_2 \cdot \phi_2\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    4. pow228.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - \color{blue}{{\phi_2}^{2}}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
  9. Applied egg-rr28.8%

    \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_1 + \phi_2}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
  10. Step-by-step derivation
    1. +-commutative28.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\color{blue}{\phi_2 + \phi_1}}\right)\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
  11. Simplified28.8%

    \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \color{blue}{\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right)}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
  12. Step-by-step derivation
    1. *-commutative28.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\left(\left({\phi_1}^{2} - {\phi_2}^{2}\right) \cdot \frac{1}{\phi_2 + \phi_1}\right) \cdot 0.5\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    2. un-div-inv29.6%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\frac{{\phi_1}^{2} - {\phi_2}^{2}}{\phi_2 + \phi_1}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    3. unpow229.6%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\color{blue}{\phi_1 \cdot \phi_1} - {\phi_2}^{2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    4. unpow229.6%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \color{blue}{\phi_2 \cdot \phi_2}}{\phi_2 + \phi_1} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    5. +-commutative29.6%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\frac{\phi_1 \cdot \phi_1 - \phi_2 \cdot \phi_2}{\color{blue}{\phi_1 + \phi_2}} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    6. flip--39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\color{blue}{\left(\phi_1 - \phi_2\right)} \cdot 0.5\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    7. metadata-eval39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{\frac{1}{2}}\right)}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    8. div-inv39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(\frac{\phi_1 - \phi_2}{2}\right)}}^{2}\right)}} \cdot \left(R \cdot 2\right) \]
    9. unpow239.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}} \cdot \left(R \cdot 2\right) \]
    10. sin-mult39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
  13. Applied egg-rr39.8%

    \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right) - \cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
  14. Step-by-step derivation
    1. div-sub39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{\frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) - 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
    2. +-inverses39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    3. cos-039.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \frac{\color{blue}{1}}{2} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    4. metadata-eval39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{0.5} - \frac{\cos \left(0.5 \cdot \left(\phi_1 - \phi_2\right) + 0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    5. distribute-rgt-out39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    6. metadata-eval39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
    7. *-rgt-identity39.8%

      \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)}} \cdot \left(R \cdot 2\right) \]
  15. Simplified39.8%

    \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_2 \cdot \cos \phi_1}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), \color{blue}{0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}}\right)}} \cdot \left(R \cdot 2\right) \]
  16. Final simplification39.8%

    \[\leadsto \tan^{-1}_* \frac{\mathsf{hypot}\left(\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right), \sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right) \cdot \sqrt{\cos \phi_1 \cdot \cos \phi_2}\right)}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}} \cdot \left(R \cdot 2\right) \]
  17. Add Preprocessing

Alternative 20: 17.3% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \sqrt{1 - \left(t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}\\ \mathbf{if}\;R \leq 2.4 \cdot 10^{-122}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{t\_1}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + 0.25 \cdot \frac{\sin \left(-0.5 \cdot \lambda_2\right) \cdot \left(\cos \phi_1 \cdot \lambda_1\right)}{\sin \left(0.5 \cdot \phi_1\right)}}{t\_1}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_1
         (sqrt
          (-
           1.0
           (+
            (* t_0 (* (* (cos phi1) (cos phi2)) t_0))
            (pow (sin (/ (- phi1 phi2) 2.0)) 2.0))))))
   (if (<= R 2.4e-122)
     (* R (* 2.0 (atan2 (sin (* 0.5 (fabs (- phi1 phi2)))) t_1)))
     (*
      R
      (*
       2.0
       (atan2
        (+
         (sin (* 0.5 (- phi1 phi2)))
         (*
          0.25
          (/
           (* (sin (* -0.5 lambda2)) (* (cos phi1) lambda1))
           (sin (* 0.5 phi1)))))
        t_1))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(((lambda1 - lambda2) / 2.0));
	double t_1 = sqrt((1.0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))));
	double tmp;
	if (R <= 2.4e-122) {
		tmp = R * (2.0 * atan2(sin((0.5 * fabs((phi1 - phi2)))), t_1));
	} else {
		tmp = R * (2.0 * atan2((sin((0.5 * (phi1 - phi2))) + (0.25 * ((sin((-0.5 * lambda2)) * (cos(phi1) * lambda1)) / sin((0.5 * phi1))))), t_1));
	}
	return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    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) / 2.0d0))
    t_1 = sqrt((1.0d0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))))
    if (r <= 2.4d-122) then
        tmp = r * (2.0d0 * atan2(sin((0.5d0 * abs((phi1 - phi2)))), t_1))
    else
        tmp = r * (2.0d0 * atan2((sin((0.5d0 * (phi1 - phi2))) + (0.25d0 * ((sin(((-0.5d0) * lambda2)) * (cos(phi1) * lambda1)) / sin((0.5d0 * phi1))))), t_1))
    end if
    code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
	double t_1 = Math.sqrt((1.0 - ((t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0)) + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))));
	double tmp;
	if (R <= 2.4e-122) {
		tmp = R * (2.0 * Math.atan2(Math.sin((0.5 * Math.abs((phi1 - phi2)))), t_1));
	} else {
		tmp = R * (2.0 * Math.atan2((Math.sin((0.5 * (phi1 - phi2))) + (0.25 * ((Math.sin((-0.5 * lambda2)) * (Math.cos(phi1) * lambda1)) / Math.sin((0.5 * phi1))))), t_1));
	}
	return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
	t_1 = math.sqrt((1.0 - ((t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0)) + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))))
	tmp = 0
	if R <= 2.4e-122:
		tmp = R * (2.0 * math.atan2(math.sin((0.5 * math.fabs((phi1 - phi2)))), t_1))
	else:
		tmp = R * (2.0 * math.atan2((math.sin((0.5 * (phi1 - phi2))) + (0.25 * ((math.sin((-0.5 * lambda2)) * (math.cos(phi1) * lambda1)) / math.sin((0.5 * phi1))))), t_1))
	return tmp
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_1 = sqrt(Float64(1.0 - Float64(Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))))
	tmp = 0.0
	if (R <= 2.4e-122)
		tmp = Float64(R * Float64(2.0 * atan(sin(Float64(0.5 * abs(Float64(phi1 - phi2)))), t_1)));
	else
		tmp = Float64(R * Float64(2.0 * atan(Float64(sin(Float64(0.5 * Float64(phi1 - phi2))) + Float64(0.25 * Float64(Float64(sin(Float64(-0.5 * lambda2)) * Float64(cos(phi1) * lambda1)) / sin(Float64(0.5 * phi1))))), t_1)));
	end
	return tmp
end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(((lambda1 - lambda2) / 2.0));
	t_1 = sqrt((1.0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))));
	tmp = 0.0;
	if (R <= 2.4e-122)
		tmp = R * (2.0 * atan2(sin((0.5 * abs((phi1 - phi2)))), t_1));
	else
		tmp = R * (2.0 * atan2((sin((0.5 * (phi1 - phi2))) + (0.25 * ((sin((-0.5 * lambda2)) * (cos(phi1) * lambda1)) / sin((0.5 * phi1))))), t_1));
	end
	tmp_2 = tmp;
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(1.0 - N[(N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[R, 2.4e-122], N[(R * N[(2.0 * N[ArcTan[N[Sin[N[(0.5 * N[Abs[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[(N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] + N[(0.25 * N[(N[(N[Sin[N[(-0.5 * lambda2), $MachinePrecision]], $MachinePrecision] * N[(N[Cos[phi1], $MachinePrecision] * lambda1), $MachinePrecision]), $MachinePrecision] / N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / t$95$1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := \sqrt{1 - \left(t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}\\
\mathbf{if}\;R \leq 2.4 \cdot 10^{-122}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{t\_1}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + 0.25 \cdot \frac{\sin \left(-0.5 \cdot \lambda_2\right) \cdot \left(\cos \phi_1 \cdot \lambda_1\right)}{\sin \left(0.5 \cdot \phi_1\right)}}{t\_1}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if R < 2.39999999999999987e-122

    1. Initial program 62.4%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 47.6%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in lambda1 around 0 31.1%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. Taylor expanded in lambda2 around 0 19.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. add-sqr-sqrt10.5%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\sqrt{\left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. pow210.6%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \sqrt{\color{blue}{{\left(\phi_1 - \phi_2\right)}^{2}}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. Applied egg-rr10.6%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\sqrt{{\left(\phi_1 - \phi_2\right)}^{2}}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. Step-by-step derivation
      1. unpow210.6%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\left|\phi_1 - \phi_2\right|}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. Simplified17.1%

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

    if 2.39999999999999987e-122 < R

    1. Initial program 68.5%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 42.6%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in lambda1 around 0 16.1%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + 0.25 \cdot \frac{\lambda_1 \cdot \left(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot \sin \left(-0.5 \cdot \lambda_2\right)\right)\right)}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. Taylor expanded in phi2 around 0 16.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + \color{blue}{0.25 \cdot \frac{\lambda_1 \cdot \left(\cos \phi_1 \cdot \sin \left(-0.5 \cdot \lambda_2\right)\right)}{\sin \left(0.5 \cdot \phi_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. associate-*r*16.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + 0.25 \cdot \frac{\color{blue}{\left(\lambda_1 \cdot \cos \phi_1\right) \cdot \sin \left(-0.5 \cdot \lambda_2\right)}}{\sin \left(0.5 \cdot \phi_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      2. *-commutative16.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + 0.25 \cdot \frac{\color{blue}{\left(\cos \phi_1 \cdot \lambda_1\right)} \cdot \sin \left(-0.5 \cdot \lambda_2\right)}{\sin \left(0.5 \cdot \phi_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. *-commutative16.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + 0.25 \cdot \frac{\left(\cos \phi_1 \cdot \lambda_1\right) \cdot \sin \color{blue}{\left(\lambda_2 \cdot -0.5\right)}}{\sin \left(0.5 \cdot \phi_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      4. *-commutative16.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + 0.25 \cdot \frac{\left(\cos \phi_1 \cdot \lambda_1\right) \cdot \sin \left(\lambda_2 \cdot -0.5\right)}{\sin \color{blue}{\left(\phi_1 \cdot 0.5\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. Simplified16.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + \color{blue}{0.25 \cdot \frac{\left(\cos \phi_1 \cdot \lambda_1\right) \cdot \sin \left(\lambda_2 \cdot -0.5\right)}{\sin \left(\phi_1 \cdot 0.5\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;R \leq 2.4 \cdot 10^{-122}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{\sqrt{1 - \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right) + 0.25 \cdot \frac{\sin \left(-0.5 \cdot \lambda_2\right) \cdot \left(\cos \phi_1 \cdot \lambda_1\right)}{\sin \left(0.5 \cdot \phi_1\right)}}{\sqrt{1 - \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 21: 17.0% accurate, 1.2× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \left(t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) + {\left(\sin \left(0.5 \cdot \phi_1\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(0.5 \cdot \phi_1\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0))))
   (*
    R
    (*
     2.0
     (atan2
      (sin (* 0.5 (- phi1 phi2)))
      (sqrt
       (-
        1.0
        (+
         (* t_0 (* (* (cos phi1) (cos phi2)) t_0))
         (pow
          (-
           (* (sin (* 0.5 phi1)) (cos (* phi2 0.5)))
           (* (cos (* 0.5 phi1)) (sin (* phi2 0.5))))
          2.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin(((lambda1 - lambda2) / 2.0));
	return R * (2.0 * atan2(sin((0.5 * (phi1 - phi2))), sqrt((1.0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + pow(((sin((0.5 * phi1)) * cos((phi2 * 0.5))) - (cos((0.5 * phi1)) * sin((phi2 * 0.5)))), 2.0))))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    t_0 = sin(((lambda1 - lambda2) / 2.0d0))
    code = r * (2.0d0 * atan2(sin((0.5d0 * (phi1 - phi2))), sqrt((1.0d0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (((sin((0.5d0 * phi1)) * cos((phi2 * 0.5d0))) - (cos((0.5d0 * phi1)) * sin((phi2 * 0.5d0)))) ** 2.0d0))))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin(((lambda1 - lambda2) / 2.0));
	return R * (2.0 * Math.atan2(Math.sin((0.5 * (phi1 - phi2))), Math.sqrt((1.0 - ((t_0 * ((Math.cos(phi1) * Math.cos(phi2)) * t_0)) + Math.pow(((Math.sin((0.5 * phi1)) * Math.cos((phi2 * 0.5))) - (Math.cos((0.5 * phi1)) * Math.sin((phi2 * 0.5)))), 2.0))))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
	return R * (2.0 * math.atan2(math.sin((0.5 * (phi1 - phi2))), math.sqrt((1.0 - ((t_0 * ((math.cos(phi1) * math.cos(phi2)) * t_0)) + math.pow(((math.sin((0.5 * phi1)) * math.cos((phi2 * 0.5))) - (math.cos((0.5 * phi1)) * math.sin((phi2 * 0.5)))), 2.0))))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	return Float64(R * Float64(2.0 * atan(sin(Float64(0.5 * Float64(phi1 - phi2))), sqrt(Float64(1.0 - Float64(Float64(t_0 * Float64(Float64(cos(phi1) * cos(phi2)) * t_0)) + (Float64(Float64(sin(Float64(0.5 * phi1)) * cos(Float64(phi2 * 0.5))) - Float64(cos(Float64(0.5 * phi1)) * sin(Float64(phi2 * 0.5)))) ^ 2.0)))))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(((lambda1 - lambda2) / 2.0));
	tmp = R * (2.0 * atan2(sin((0.5 * (phi1 - phi2))), sqrt((1.0 - ((t_0 * ((cos(phi1) * cos(phi2)) * t_0)) + (((sin((0.5 * phi1)) * cos((phi2 * 0.5))) - (cos((0.5 * phi1)) * sin((phi2 * 0.5)))) ^ 2.0))))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(t$95$0 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision] + N[Power[N[(N[(N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \left(t\_0 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) + {\left(\sin \left(0.5 \cdot \phi_1\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(0.5 \cdot \phi_1\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in lambda2 around 0 45.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Taylor expanded in lambda1 around 0 29.7%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Taylor expanded in lambda2 around 0 17.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Step-by-step derivation
    1. div-sub64.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \color{blue}{\left(\frac{\phi_1}{2} - \frac{\phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. sin-diff65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)} - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \color{blue}{\left(\phi_1 \cdot \frac{1}{2}\right)} \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot \color{blue}{0.5}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. div-inv65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \color{blue}{\left(\phi_2 \cdot \frac{1}{2}\right)}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    10. metadata-eval65.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot \color{blue}{0.5}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  7. Applied egg-rr18.4%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  8. Final simplification18.4%

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

Alternative 22: 17.3% accurate, 1.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := \cos \phi_1 \cdot \cos \phi_2\\ \mathbf{if}\;R \leq 1.9 \cdot 10^{-113}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{\sqrt{1 - \left(t\_1 \cdot \left(t\_2 \cdot t\_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_0}{\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(t\_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {t\_0}^{2}\right)\right)\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 (- phi1 phi2))))
        (t_1 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_2 (* (cos phi1) (cos phi2))))
   (if (<= R 1.9e-113)
     (*
      R
      (*
       2.0
       (atan2
        (sin (* 0.5 (fabs (- phi1 phi2))))
        (sqrt
         (-
          1.0
          (+ (* t_1 (* t_2 t_1)) (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))))))
     (*
      R
      (*
       2.0
       (atan2
        t_0
        (sqrt
         (expm1
          (log1p
           (-
            1.0
            (fma
             t_2
             (+ 0.5 (* -0.5 (cos (- lambda1 lambda2))))
             (pow t_0 2.0))))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((0.5 * (phi1 - phi2)));
	double t_1 = sin(((lambda1 - lambda2) / 2.0));
	double t_2 = cos(phi1) * cos(phi2);
	double tmp;
	if (R <= 1.9e-113) {
		tmp = R * (2.0 * atan2(sin((0.5 * fabs((phi1 - phi2)))), sqrt((1.0 - ((t_1 * (t_2 * t_1)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))))));
	} else {
		tmp = R * (2.0 * atan2(t_0, sqrt(expm1(log1p((1.0 - fma(t_2, (0.5 + (-0.5 * cos((lambda1 - lambda2)))), pow(t_0, 2.0))))))));
	}
	return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(0.5 * Float64(phi1 - phi2)))
	t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_2 = Float64(cos(phi1) * cos(phi2))
	tmp = 0.0
	if (R <= 1.9e-113)
		tmp = Float64(R * Float64(2.0 * atan(sin(Float64(0.5 * abs(Float64(phi1 - phi2)))), sqrt(Float64(1.0 - Float64(Float64(t_1 * Float64(t_2 * t_1)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0)))))));
	else
		tmp = Float64(R * Float64(2.0 * atan(t_0, sqrt(expm1(log1p(Float64(1.0 - fma(t_2, Float64(0.5 + Float64(-0.5 * cos(Float64(lambda1 - lambda2)))), (t_0 ^ 2.0)))))))));
	end
	return tmp
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[R, 1.9e-113], N[(R * N[(2.0 * N[ArcTan[N[Sin[N[(0.5 * N[Abs[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(t$95$1 * N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$0 / N[Sqrt[N[(Exp[N[Log[1 + N[(1.0 - N[(t$95$2 * N[(0.5 + N[(-0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := \cos \phi_1 \cdot \cos \phi_2\\
\mathbf{if}\;R \leq 1.9 \cdot 10^{-113}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{\sqrt{1 - \left(t\_1 \cdot \left(t\_2 \cdot t\_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_0}{\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(t\_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {t\_0}^{2}\right)\right)\right)}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if R < 1.89999999999999992e-113

    1. Initial program 62.0%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 46.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in lambda1 around 0 30.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. Taylor expanded in lambda2 around 0 18.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. add-sqr-sqrt10.3%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\sqrt{\left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. pow210.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \sqrt{\color{blue}{{\left(\phi_1 - \phi_2\right)}^{2}}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. Applied egg-rr10.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\sqrt{{\left(\phi_1 - \phi_2\right)}^{2}}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. Step-by-step derivation
      1. unpow210.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \sqrt{\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      2. rem-sqrt-square16.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\left|\phi_1 - \phi_2\right|}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. Simplified16.9%

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

    if 1.89999999999999992e-113 < R

    1. Initial program 69.6%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 44.1%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in lambda1 around 0 27.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. Taylor expanded in lambda2 around 0 15.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. +-commutative15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \color{blue}{\left(\left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}}\right) \]
      2. associate-*l*15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \left(\color{blue}{\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)} + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right) \]
      3. fma-undefine15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \color{blue}{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}}\right) \]
      4. expm1-log1p-u15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right), {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)\right)\right)}}}\right) \]
    7. Applied egg-rr15.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)\right)}}}\right) \]
    8. Step-by-step derivation
      1. *-commutative15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\color{blue}{\cos \phi_2 \cdot \cos \phi_1}, 0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)\right)}}\right) \]
      2. cancel-sign-sub-inv15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, \color{blue}{0.5 + \left(-0.5\right) \cdot \cos \left(\lambda_1 - \lambda_2\right)}, {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)\right)}}\right) \]
      3. metadata-eval15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + \color{blue}{-0.5} \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)\right)}}\right) \]
      4. *-commutative15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \color{blue}{\left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}^{2}\right)\right)\right)}}\right) \]
    9. Simplified15.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right)\right)}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;R \leq 1.9 \cdot 10^{-113}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{\sqrt{1 - \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right)\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 23: 17.3% accurate, 1.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := \cos \phi_1 \cdot \cos \phi_2\\ \mathbf{if}\;R \leq 1.35 \cdot 10^{-115}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{\sqrt{1 - \left(t\_1 \cdot \left(t\_2 \cdot t\_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_0}{\sqrt{1 + \left(t\_2 \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right) - {t\_0}^{2}\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 (- phi1 phi2))))
        (t_1 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_2 (* (cos phi1) (cos phi2))))
   (if (<= R 1.35e-115)
     (*
      R
      (*
       2.0
       (atan2
        (sin (* 0.5 (fabs (- phi1 phi2))))
        (sqrt
         (-
          1.0
          (+ (* t_1 (* t_2 t_1)) (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))))))
     (*
      R
      (*
       2.0
       (atan2
        t_0
        (sqrt
         (+
          1.0
          (-
           (* t_2 (- (* 0.5 (cos (- lambda1 lambda2))) 0.5))
           (pow t_0 2.0))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((0.5 * (phi1 - phi2)));
	double t_1 = sin(((lambda1 - lambda2) / 2.0));
	double t_2 = cos(phi1) * cos(phi2);
	double tmp;
	if (R <= 1.35e-115) {
		tmp = R * (2.0 * atan2(sin((0.5 * fabs((phi1 - phi2)))), sqrt((1.0 - ((t_1 * (t_2 * t_1)) + pow(sin(((phi1 - phi2) / 2.0)), 2.0))))));
	} else {
		tmp = R * (2.0 * atan2(t_0, sqrt((1.0 + ((t_2 * ((0.5 * cos((lambda1 - lambda2))) - 0.5)) - pow(t_0, 2.0))))));
	}
	return tmp;
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    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((0.5d0 * (phi1 - phi2)))
    t_1 = sin(((lambda1 - lambda2) / 2.0d0))
    t_2 = cos(phi1) * cos(phi2)
    if (r <= 1.35d-115) then
        tmp = r * (2.0d0 * atan2(sin((0.5d0 * abs((phi1 - phi2)))), sqrt((1.0d0 - ((t_1 * (t_2 * t_1)) + (sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0))))))
    else
        tmp = r * (2.0d0 * atan2(t_0, sqrt((1.0d0 + ((t_2 * ((0.5d0 * cos((lambda1 - lambda2))) - 0.5d0)) - (t_0 ** 2.0d0))))))
    end if
    code = tmp
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin((0.5 * (phi1 - phi2)));
	double t_1 = Math.sin(((lambda1 - lambda2) / 2.0));
	double t_2 = Math.cos(phi1) * Math.cos(phi2);
	double tmp;
	if (R <= 1.35e-115) {
		tmp = R * (2.0 * Math.atan2(Math.sin((0.5 * Math.abs((phi1 - phi2)))), Math.sqrt((1.0 - ((t_1 * (t_2 * t_1)) + Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0))))));
	} else {
		tmp = R * (2.0 * Math.atan2(t_0, Math.sqrt((1.0 + ((t_2 * ((0.5 * Math.cos((lambda1 - lambda2))) - 0.5)) - Math.pow(t_0, 2.0))))));
	}
	return tmp;
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin((0.5 * (phi1 - phi2)))
	t_1 = math.sin(((lambda1 - lambda2) / 2.0))
	t_2 = math.cos(phi1) * math.cos(phi2)
	tmp = 0
	if R <= 1.35e-115:
		tmp = R * (2.0 * math.atan2(math.sin((0.5 * math.fabs((phi1 - phi2)))), math.sqrt((1.0 - ((t_1 * (t_2 * t_1)) + math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0))))))
	else:
		tmp = R * (2.0 * math.atan2(t_0, math.sqrt((1.0 + ((t_2 * ((0.5 * math.cos((lambda1 - lambda2))) - 0.5)) - math.pow(t_0, 2.0))))))
	return tmp
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(0.5 * Float64(phi1 - phi2)))
	t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_2 = Float64(cos(phi1) * cos(phi2))
	tmp = 0.0
	if (R <= 1.35e-115)
		tmp = Float64(R * Float64(2.0 * atan(sin(Float64(0.5 * abs(Float64(phi1 - phi2)))), sqrt(Float64(1.0 - Float64(Float64(t_1 * Float64(t_2 * t_1)) + (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0)))))));
	else
		tmp = Float64(R * Float64(2.0 * atan(t_0, sqrt(Float64(1.0 + Float64(Float64(t_2 * Float64(Float64(0.5 * cos(Float64(lambda1 - lambda2))) - 0.5)) - (t_0 ^ 2.0)))))));
	end
	return tmp
end
function tmp_2 = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin((0.5 * (phi1 - phi2)));
	t_1 = sin(((lambda1 - lambda2) / 2.0));
	t_2 = cos(phi1) * cos(phi2);
	tmp = 0.0;
	if (R <= 1.35e-115)
		tmp = R * (2.0 * atan2(sin((0.5 * abs((phi1 - phi2)))), sqrt((1.0 - ((t_1 * (t_2 * t_1)) + (sin(((phi1 - phi2) / 2.0)) ^ 2.0))))));
	else
		tmp = R * (2.0 * atan2(t_0, sqrt((1.0 + ((t_2 * ((0.5 * cos((lambda1 - lambda2))) - 0.5)) - (t_0 ^ 2.0))))));
	end
	tmp_2 = tmp;
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[R, 1.35e-115], N[(R * N[(2.0 * N[ArcTan[N[Sin[N[(0.5 * N[Abs[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(t$95$1 * N[(t$95$2 * t$95$1), $MachinePrecision]), $MachinePrecision] + N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$0 / N[Sqrt[N[(1.0 + N[(N[(t$95$2 * N[(N[(0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := \cos \phi_1 \cdot \cos \phi_2\\
\mathbf{if}\;R \leq 1.35 \cdot 10^{-115}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{\sqrt{1 - \left(t\_1 \cdot \left(t\_2 \cdot t\_1\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_0}{\sqrt{1 + \left(t\_2 \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right) - {t\_0}^{2}\right)}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if R < 1.35e-115

    1. Initial program 62.0%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 46.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in lambda1 around 0 30.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. Taylor expanded in lambda2 around 0 18.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. add-sqr-sqrt10.3%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\sqrt{\left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. pow210.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \sqrt{\color{blue}{{\left(\phi_1 - \phi_2\right)}^{2}}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    7. Applied egg-rr10.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\sqrt{{\left(\phi_1 - \phi_2\right)}^{2}}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. Step-by-step derivation
      1. unpow210.5%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \sqrt{\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      2. rem-sqrt-square16.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \color{blue}{\left|\phi_1 - \phi_2\right|}\right)}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    9. Simplified16.9%

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

    if 1.35e-115 < R

    1. Initial program 69.6%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Add Preprocessing
    3. Taylor expanded in lambda2 around 0 44.1%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. Taylor expanded in lambda1 around 0 27.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. Taylor expanded in lambda2 around 0 15.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. associate--r+15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}}\right) \]
      2. sub-neg15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{\left(1 + \left(-{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)\right)} - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}\right) \]
      3. associate--l+15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{1 + \left(\left(-{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}}\right) \]
      4. div-inv15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(-{\sin \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. metadata-eval15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(-{\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. associate-*l*15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(-{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) - \color{blue}{\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}\right)}}\right) \]
      7. sqr-sin-a15.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(-{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)\right)}\right)}}\right) \]
    7. Applied egg-rr15.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{1 + \left(\left(-{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification16.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;R \leq 1.35 \cdot 10^{-115}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left|\phi_1 - \phi_2\right|\right)}{\sqrt{1 - \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right) - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 24: 16.4% accurate, 1.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_0}{\sqrt{1 - \left({t\_0}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \lambda_1\right)}^{2}\right)\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 (- phi1 phi2)))))
   (*
    R
    (*
     2.0
     (atan2
      t_0
      (sqrt
       (-
        1.0
        (+
         (pow t_0 2.0)
         (* (cos phi1) (* (cos phi2) (pow (sin (* 0.5 lambda1)) 2.0)))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((0.5 * (phi1 - phi2)));
	return R * (2.0 * atan2(t_0, sqrt((1.0 - (pow(t_0, 2.0) + (cos(phi1) * (cos(phi2) * pow(sin((0.5 * lambda1)), 2.0))))))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    t_0 = sin((0.5d0 * (phi1 - phi2)))
    code = r * (2.0d0 * atan2(t_0, sqrt((1.0d0 - ((t_0 ** 2.0d0) + (cos(phi1) * (cos(phi2) * (sin((0.5d0 * lambda1)) ** 2.0d0))))))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin((0.5 * (phi1 - phi2)));
	return R * (2.0 * Math.atan2(t_0, Math.sqrt((1.0 - (Math.pow(t_0, 2.0) + (Math.cos(phi1) * (Math.cos(phi2) * Math.pow(Math.sin((0.5 * lambda1)), 2.0))))))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin((0.5 * (phi1 - phi2)))
	return R * (2.0 * math.atan2(t_0, math.sqrt((1.0 - (math.pow(t_0, 2.0) + (math.cos(phi1) * (math.cos(phi2) * math.pow(math.sin((0.5 * lambda1)), 2.0))))))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(0.5 * Float64(phi1 - phi2)))
	return Float64(R * Float64(2.0 * atan(t_0, sqrt(Float64(1.0 - Float64((t_0 ^ 2.0) + Float64(cos(phi1) * Float64(cos(phi2) * (sin(Float64(0.5 * lambda1)) ^ 2.0)))))))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin((0.5 * (phi1 - phi2)));
	tmp = R * (2.0 * atan2(t_0, sqrt((1.0 - ((t_0 ^ 2.0) + (cos(phi1) * (cos(phi2) * (sin((0.5 * lambda1)) ^ 2.0))))))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[t$95$0 / N[Sqrt[N[(1.0 - N[(N[Power[t$95$0, 2.0], $MachinePrecision] + N[(N[Cos[phi1], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Power[N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_0}{\sqrt{1 - \left({t\_0}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \lambda_1\right)}^{2}\right)\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in lambda2 around 0 45.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Taylor expanded in lambda1 around 0 29.7%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Taylor expanded in lambda2 around 0 17.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Taylor expanded in lambda2 around 0 17.9%

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 - \left({\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2} + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \lambda_1\right)}^{2}\right)\right)}}\right) \]
  8. Add Preprocessing

Alternative 25: 16.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_0}{\sqrt{1 + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right) - {t\_0}^{2}\right)}}\right) \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (* 0.5 (- phi1 phi2)))))
   (*
    R
    (*
     2.0
     (atan2
      t_0
      (sqrt
       (+
        1.0
        (-
         (*
          (* (cos phi1) (cos phi2))
          (- (* 0.5 (cos (- lambda1 lambda2))) 0.5))
         (pow t_0 2.0)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((0.5 * (phi1 - phi2)));
	return R * (2.0 * atan2(t_0, sqrt((1.0 + (((cos(phi1) * cos(phi2)) * ((0.5 * cos((lambda1 - lambda2))) - 0.5)) - pow(t_0, 2.0))))));
}
real(8) function code(r, lambda1, lambda2, phi1, phi2)
    real(8), intent (in) :: r
    real(8), intent (in) :: lambda1
    real(8), intent (in) :: lambda2
    real(8), intent (in) :: phi1
    real(8), intent (in) :: phi2
    real(8) :: t_0
    t_0 = sin((0.5d0 * (phi1 - phi2)))
    code = r * (2.0d0 * atan2(t_0, sqrt((1.0d0 + (((cos(phi1) * cos(phi2)) * ((0.5d0 * cos((lambda1 - lambda2))) - 0.5d0)) - (t_0 ** 2.0d0))))))
end function
public static double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = Math.sin((0.5 * (phi1 - phi2)));
	return R * (2.0 * Math.atan2(t_0, Math.sqrt((1.0 + (((Math.cos(phi1) * Math.cos(phi2)) * ((0.5 * Math.cos((lambda1 - lambda2))) - 0.5)) - Math.pow(t_0, 2.0))))));
}
def code(R, lambda1, lambda2, phi1, phi2):
	t_0 = math.sin((0.5 * (phi1 - phi2)))
	return R * (2.0 * math.atan2(t_0, math.sqrt((1.0 + (((math.cos(phi1) * math.cos(phi2)) * ((0.5 * math.cos((lambda1 - lambda2))) - 0.5)) - math.pow(t_0, 2.0))))))
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(0.5 * Float64(phi1 - phi2)))
	return Float64(R * Float64(2.0 * atan(t_0, sqrt(Float64(1.0 + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * Float64(Float64(0.5 * cos(Float64(lambda1 - lambda2))) - 0.5)) - (t_0 ^ 2.0)))))))
end
function tmp = code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin((0.5 * (phi1 - phi2)));
	tmp = R * (2.0 * atan2(t_0, sqrt((1.0 + (((cos(phi1) * cos(phi2)) * ((0.5 * cos((lambda1 - lambda2))) - 0.5)) - (t_0 ^ 2.0))))));
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[t$95$0 / N[Sqrt[N[(1.0 + N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[Cos[N[(lambda1 - lambda2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - 0.5), $MachinePrecision]), $MachinePrecision] - N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_0}{\sqrt{1 + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right) - {t\_0}^{2}\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 64.4%

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in lambda2 around 0 45.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Taylor expanded in lambda1 around 0 29.7%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Taylor expanded in lambda2 around 0 17.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Step-by-step derivation
    1. associate--r+17.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}}\right) \]
    2. sub-neg17.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{\left(1 + \left(-{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)\right)} - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}\right) \]
    3. associate--l+17.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{1 + \left(\left(-{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}}\right) \]
    4. div-inv17.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(-{\sin \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. metadata-eval17.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(-{\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}^{2}\right) - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. associate-*l*17.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(-{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) - \color{blue}{\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}\right)}}\right) \]
    7. sqr-sin-a17.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{1 + \left(\left(-{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)\right)}\right)}}\right) \]
  7. Applied egg-rr17.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{1 + \left(\left(-{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}}}\right) \]
  8. Final simplification17.9%

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

Alternative 26: 14.1% accurate, 1.9× speedup?

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

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

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in lambda2 around 0 45.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Taylor expanded in lambda1 around 0 29.7%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Taylor expanded in lambda2 around 0 17.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Taylor expanded in phi2 around 0 16.2%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{1 - \left(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
  7. Step-by-step derivation
    1. +-commutative49.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    2. associate--r+49.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    3. unpow249.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(0.5 \cdot \phi_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    4. 1-sub-sin49.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(0.5 \cdot \phi_1\right) \cdot \cos \left(0.5 \cdot \phi_1\right)} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    5. unpow249.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(0.5 \cdot \phi_1\right)}^{2}} - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    6. *-commutative49.8%

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1}}}\right) \]
  9. Final simplification16.2%

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

Alternative 27: 14.2% accurate, 1.9× speedup?

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

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

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  2. Add Preprocessing
  3. Taylor expanded in lambda2 around 0 45.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \color{blue}{\sin \left(0.5 \cdot \lambda_1\right)}}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  4. Taylor expanded in lambda1 around 0 29.7%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\sin \left(-0.5 \cdot \lambda_2\right)}\right) \cdot \sin \left(0.5 \cdot \lambda_1\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  5. Taylor expanded in lambda2 around 0 17.9%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Taylor expanded in phi1 around 0 14.7%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
  7. Step-by-step derivation
    1. +-commutative50.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    2. associate--r+50.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    3. unpow250.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    4. 1-sub-sin49.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    5. unpow249.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2}} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
  8. Simplified14.7%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  9. Add Preprocessing

Reproduce

?
herbie shell --seed 2024121 
(FPCore (R lambda1 lambda2 phi1 phi2)
  :name "Distance on a great circle"
  :precision binary64
  (* R (* 2.0 (atan2 (sqrt (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) (* (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2.0))) (sin (/ (- lambda1 lambda2) 2.0))))) (sqrt (- 1.0 (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) (* (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2.0))) (sin (/ (- lambda1 lambda2) 2.0))))))))))