Distance on a great circle

Percentage Accurate: 62.6% → 79.1%
Time: 37.4s
Alternatives: 24
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 24 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: 62.6% 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: 79.1% accurate, 0.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_1 := \sin \left(\frac{\phi_1}{2}\right)\\ t_2 := \cos \left(\frac{\phi_2}{2}\right) \cdot t\_1\\ t_3 := \sin \left(\frac{\phi_2}{-2}\right)\\ t_4 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_5 := \cos \left(\frac{\phi_2}{-2}\right)\\ t_6 := \mathsf{fma}\left(t\_3, \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot t\_5\right)\\ t_7 := \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_4\right) \cdot t\_4\\ t_8 := \cos \left(\frac{\phi_1}{-2}\right)\\ t_9 := t\_8 \cdot t\_3\\ t_10 := {t\_9}^{4}\\ t_11 := {t\_2}^{4}\\ \mathbf{if}\;\phi_1 \leq -125 \lor \neg \left(\phi_1 \leq 1.38 \cdot 10^{-14}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\frac{\left({t\_9}^{6} - {t\_2}^{6}\right) \cdot \left(t\_10 - t\_11\right)}{\left(\left({\left(t\_9 \cdot t\_2\right)}^{2} + t\_11\right) + t\_10\right) \cdot \left({t\_2}^{2} + {t\_9}^{2}\right)}}{t\_6 \cdot t\_6} + t\_7}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -t\_8, t\_5 \cdot t\_1\right)\right)}^{2} + t\_7\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_0 + t\_7}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_0}}\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 (sin (/ phi1 2.0)))
        (t_2 (* (cos (/ phi2 2.0)) t_1))
        (t_3 (sin (/ phi2 -2.0)))
        (t_4 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_5 (cos (/ phi2 -2.0)))
        (t_6 (fma t_3 (cos (/ phi1 2.0)) (* (sin (/ phi1 -2.0)) t_5)))
        (t_7 (* (* (* (cos phi1) (cos phi2)) t_4) t_4))
        (t_8 (cos (/ phi1 -2.0)))
        (t_9 (* t_8 t_3))
        (t_10 (pow t_9 4.0))
        (t_11 (pow t_2 4.0)))
   (if (or (<= phi1 -125.0) (not (<= phi1 1.38e-14)))
     (*
      R
      (*
       2.0
       (atan2
        (sqrt
         (+
          (/
           (/
            (* (- (pow t_9 6.0) (pow t_2 6.0)) (- t_10 t_11))
            (*
             (+ (+ (pow (* t_9 t_2) 2.0) t_11) t_10)
             (+ (pow t_2 2.0) (pow t_9 2.0))))
           (* t_6 t_6))
          t_7))
        (sqrt
         (-
          1.0
          (+ (pow (fma (sin (/ phi2 2.0)) (- t_8) (* t_5 t_1)) 2.0) t_7))))))
     (*
      R
      (*
       2.0
       (atan2
        (sqrt (+ t_0 t_7))
        (sqrt
         (-
          (-
           1.0
           (*
            (pow
             (-
              (* (sin (/ lambda1 2.0)) (cos (/ lambda2 2.0)))
              (* (cos (/ lambda1 2.0)) (sin (/ lambda2 2.0))))
             2.0)
            (* (cos phi2) (cos phi1))))
          t_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 = sin((phi1 / 2.0));
	double t_2 = cos((phi2 / 2.0)) * t_1;
	double t_3 = sin((phi2 / -2.0));
	double t_4 = sin(((lambda1 - lambda2) / 2.0));
	double t_5 = cos((phi2 / -2.0));
	double t_6 = fma(t_3, cos((phi1 / 2.0)), (sin((phi1 / -2.0)) * t_5));
	double t_7 = ((cos(phi1) * cos(phi2)) * t_4) * t_4;
	double t_8 = cos((phi1 / -2.0));
	double t_9 = t_8 * t_3;
	double t_10 = pow(t_9, 4.0);
	double t_11 = pow(t_2, 4.0);
	double tmp;
	if ((phi1 <= -125.0) || !(phi1 <= 1.38e-14)) {
		tmp = R * (2.0 * atan2(sqrt((((((pow(t_9, 6.0) - pow(t_2, 6.0)) * (t_10 - t_11)) / (((pow((t_9 * t_2), 2.0) + t_11) + t_10) * (pow(t_2, 2.0) + pow(t_9, 2.0)))) / (t_6 * t_6)) + t_7)), sqrt((1.0 - (pow(fma(sin((phi2 / 2.0)), -t_8, (t_5 * t_1)), 2.0) + t_7)))));
	} else {
		tmp = R * (2.0 * atan2(sqrt((t_0 + t_7)), sqrt(((1.0 - (pow(((sin((lambda1 / 2.0)) * cos((lambda2 / 2.0))) - (cos((lambda1 / 2.0)) * sin((lambda2 / 2.0)))), 2.0) * (cos(phi2) * cos(phi1)))) - t_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(phi1 / 2.0))
	t_2 = Float64(cos(Float64(phi2 / 2.0)) * t_1)
	t_3 = sin(Float64(phi2 / -2.0))
	t_4 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_5 = cos(Float64(phi2 / -2.0))
	t_6 = fma(t_3, cos(Float64(phi1 / 2.0)), Float64(sin(Float64(phi1 / -2.0)) * t_5))
	t_7 = Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_4) * t_4)
	t_8 = cos(Float64(phi1 / -2.0))
	t_9 = Float64(t_8 * t_3)
	t_10 = t_9 ^ 4.0
	t_11 = t_2 ^ 4.0
	tmp = 0.0
	if ((phi1 <= -125.0) || !(phi1 <= 1.38e-14))
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(Float64(Float64(Float64((t_9 ^ 6.0) - (t_2 ^ 6.0)) * Float64(t_10 - t_11)) / Float64(Float64(Float64((Float64(t_9 * t_2) ^ 2.0) + t_11) + t_10) * Float64((t_2 ^ 2.0) + (t_9 ^ 2.0)))) / Float64(t_6 * t_6)) + t_7)), sqrt(Float64(1.0 - Float64((fma(sin(Float64(phi2 / 2.0)), Float64(-t_8), Float64(t_5 * t_1)) ^ 2.0) + t_7))))));
	else
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_0 + t_7)), sqrt(Float64(Float64(1.0 - Float64((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) * Float64(cos(phi2) * cos(phi1)))) - t_0)))));
	end
	return 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[Sin[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]}, Block[{t$95$3 = N[Sin[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Cos[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(t$95$3 * N[Cos[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision] + N[(N[Sin[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision] * t$95$5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$7 = N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision] * t$95$4), $MachinePrecision]}, Block[{t$95$8 = N[Cos[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$9 = N[(t$95$8 * t$95$3), $MachinePrecision]}, Block[{t$95$10 = N[Power[t$95$9, 4.0], $MachinePrecision]}, Block[{t$95$11 = N[Power[t$95$2, 4.0], $MachinePrecision]}, If[Or[LessEqual[phi1, -125.0], N[Not[LessEqual[phi1, 1.38e-14]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[(N[(N[(N[Power[t$95$9, 6.0], $MachinePrecision] - N[Power[t$95$2, 6.0], $MachinePrecision]), $MachinePrecision] * N[(t$95$10 - t$95$11), $MachinePrecision]), $MachinePrecision] / N[(N[(N[(N[Power[N[(t$95$9 * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] + t$95$11), $MachinePrecision] + t$95$10), $MachinePrecision] * N[(N[Power[t$95$2, 2.0], $MachinePrecision] + N[Power[t$95$9, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$6 * t$95$6), $MachinePrecision]), $MachinePrecision] + t$95$7), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(N[Sin[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision] * (-t$95$8) + N[(t$95$5 * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$7), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$0 + t$95$7), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[(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] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$0), $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(\frac{\phi_1}{2}\right)\\
t_2 := \cos \left(\frac{\phi_2}{2}\right) \cdot t\_1\\
t_3 := \sin \left(\frac{\phi_2}{-2}\right)\\
t_4 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_5 := \cos \left(\frac{\phi_2}{-2}\right)\\
t_6 := \mathsf{fma}\left(t\_3, \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot t\_5\right)\\
t_7 := \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_4\right) \cdot t\_4\\
t_8 := \cos \left(\frac{\phi_1}{-2}\right)\\
t_9 := t\_8 \cdot t\_3\\
t_10 := {t\_9}^{4}\\
t_11 := {t\_2}^{4}\\
\mathbf{if}\;\phi_1 \leq -125 \lor \neg \left(\phi_1 \leq 1.38 \cdot 10^{-14}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\frac{\left({t\_9}^{6} - {t\_2}^{6}\right) \cdot \left(t\_10 - t\_11\right)}{\left(\left({\left(t\_9 \cdot t\_2\right)}^{2} + t\_11\right) + t\_10\right) \cdot \left({t\_2}^{2} + {t\_9}^{2}\right)}}{t\_6 \cdot t\_6} + t\_7}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -t\_8, t\_5 \cdot t\_1\right)\right)}^{2} + t\_7\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_0 + t\_7}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_0}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi1 < -125 or 1.38000000000000002e-14 < phi1

    1. Initial program 52.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. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6455.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 - \left({\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 \color{blue}{\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. Applied rewrites55.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 - \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) \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      2. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6455.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval55.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      15. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      16. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
      17. lower-*.f6455.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites55.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 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites79.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites79.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{\frac{\left({\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right)}^{6} - {\left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)}^{6}\right) \cdot \left({\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right)}^{4} - {\left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)}^{4}\right)}{\left(\left({\left(\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right) \cdot \left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)\right)}^{2} + {\left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)}^{4}\right) + {\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right)}^{4}\right) \cdot \left({\left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)}^{2} + {\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]

    if -125 < phi1 < 1.38000000000000002e-14

    1. Initial program 76.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
      4. associate--r+N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
      5. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    4. Applied rewrites76.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}{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    5. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      2. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      3. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\color{blue}{\lambda_1 - \lambda_2}}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      4. div-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1}{2} - \frac{\lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\cos \left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \color{blue}{\left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \color{blue}{\left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      16. lower-/.f6477.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{\left(1 - {\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 \color{blue}{\left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
    6. Applied rewrites77.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{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification78.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -125 \lor \neg \left(\phi_1 \leq 1.38 \cdot 10^{-14}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\frac{\left({\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right)}^{6} - {\left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)}^{6}\right) \cdot \left({\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right)}^{4} - {\left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)}^{4}\right)}{\left(\left({\left(\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right) \cdot \left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)\right)}^{2} + {\left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)}^{4}\right) + {\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right)}^{4}\right) \cdot \left({\left(\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)}^{2} + {\left(\cos \left(\frac{\phi_1}{-2}\right) \cdot \sin \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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)\\ \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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 2: 79.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := -\cos \left(\frac{\phi_1}{-2}\right)\\ t_1 := \sin \left(\frac{\phi_2}{-2}\right)\\ t_2 := \cos \left(\frac{\phi_1}{2}\right)\\ t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_4 := \cos \left(\frac{\phi_2}{-2}\right)\\ t_5 := \mathsf{fma}\left(t\_1, t\_2, \sin \left(\frac{\phi_1}{-2}\right) \cdot t\_4\right)\\ t_6 := t\_5 \cdot t\_5\\ t_7 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_8 := \sin \left(\frac{\phi_1}{2}\right)\\ t_9 := {\left(t\_1 \cdot t\_2\right)}^{2} - {\left(t\_8 \cdot t\_4\right)}^{2}\\ t_10 := \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_7\right) \cdot t\_7\\ t_11 := \sin \left(\frac{\phi_2}{2}\right)\\ \mathbf{if}\;\phi_1 \leq -125:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{t\_6} + t\_10}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(t\_11, t\_0, t\_4 \cdot t\_8\right)\right)}^{2} + t\_10\right)}}\right)\\ \mathbf{elif}\;\phi_1 \leq 1.38 \cdot 10^{-14}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_3 + t\_10}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_3}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{t\_9 \cdot t\_9}{t\_6} + t\_10}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(t\_8, \cos \left(\frac{\phi_2}{2}\right), t\_0 \cdot t\_11\right)\right)}^{2} + t\_10\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (- (cos (/ phi1 -2.0))))
        (t_1 (sin (/ phi2 -2.0)))
        (t_2 (cos (/ phi1 2.0)))
        (t_3 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0))
        (t_4 (cos (/ phi2 -2.0)))
        (t_5 (fma t_1 t_2 (* (sin (/ phi1 -2.0)) t_4)))
        (t_6 (* t_5 t_5))
        (t_7 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_8 (sin (/ phi1 2.0)))
        (t_9 (- (pow (* t_1 t_2) 2.0) (pow (* t_8 t_4) 2.0)))
        (t_10 (* (* (* (cos phi1) (cos phi2)) t_7) t_7))
        (t_11 (sin (/ phi2 2.0))))
   (if (<= phi1 -125.0)
     (*
      R
      (*
       2.0
       (atan2
        (sqrt
         (+
          (/
           (pow
            (fma
             (pow (sin (* -0.5 phi2)) 2.0)
             (pow (cos (* 0.5 phi1)) 2.0)
             (* (- (pow (sin (* 0.5 phi1)) 2.0)) (pow (cos (* 0.5 phi2)) 2.0)))
            2.0)
           t_6)
          t_10))
        (sqrt (- 1.0 (+ (pow (fma t_11 t_0 (* t_4 t_8)) 2.0) t_10))))))
     (if (<= phi1 1.38e-14)
       (*
        R
        (*
         2.0
         (atan2
          (sqrt (+ t_3 t_10))
          (sqrt
           (-
            (-
             1.0
             (*
              (pow
               (-
                (* (sin (/ lambda1 2.0)) (cos (/ lambda2 2.0)))
                (* (cos (/ lambda1 2.0)) (sin (/ lambda2 2.0))))
               2.0)
              (* (cos phi2) (cos phi1))))
            t_3)))))
       (*
        R
        (*
         2.0
         (atan2
          (sqrt (+ (/ (* t_9 t_9) t_6) t_10))
          (sqrt
           (-
            1.0
            (+
             (pow (fma t_8 (cos (/ phi2 2.0)) (* t_0 t_11)) 2.0)
             t_10))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = -cos((phi1 / -2.0));
	double t_1 = sin((phi2 / -2.0));
	double t_2 = cos((phi1 / 2.0));
	double t_3 = pow(sin(((phi1 - phi2) / 2.0)), 2.0);
	double t_4 = cos((phi2 / -2.0));
	double t_5 = fma(t_1, t_2, (sin((phi1 / -2.0)) * t_4));
	double t_6 = t_5 * t_5;
	double t_7 = sin(((lambda1 - lambda2) / 2.0));
	double t_8 = sin((phi1 / 2.0));
	double t_9 = pow((t_1 * t_2), 2.0) - pow((t_8 * t_4), 2.0);
	double t_10 = ((cos(phi1) * cos(phi2)) * t_7) * t_7;
	double t_11 = sin((phi2 / 2.0));
	double tmp;
	if (phi1 <= -125.0) {
		tmp = R * (2.0 * atan2(sqrt(((pow(fma(pow(sin((-0.5 * phi2)), 2.0), pow(cos((0.5 * phi1)), 2.0), (-pow(sin((0.5 * phi1)), 2.0) * pow(cos((0.5 * phi2)), 2.0))), 2.0) / t_6) + t_10)), sqrt((1.0 - (pow(fma(t_11, t_0, (t_4 * t_8)), 2.0) + t_10)))));
	} else if (phi1 <= 1.38e-14) {
		tmp = R * (2.0 * atan2(sqrt((t_3 + t_10)), sqrt(((1.0 - (pow(((sin((lambda1 / 2.0)) * cos((lambda2 / 2.0))) - (cos((lambda1 / 2.0)) * sin((lambda2 / 2.0)))), 2.0) * (cos(phi2) * cos(phi1)))) - t_3))));
	} else {
		tmp = R * (2.0 * atan2(sqrt((((t_9 * t_9) / t_6) + t_10)), sqrt((1.0 - (pow(fma(t_8, cos((phi2 / 2.0)), (t_0 * t_11)), 2.0) + t_10)))));
	}
	return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = Float64(-cos(Float64(phi1 / -2.0)))
	t_1 = sin(Float64(phi2 / -2.0))
	t_2 = cos(Float64(phi1 / 2.0))
	t_3 = sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0
	t_4 = cos(Float64(phi2 / -2.0))
	t_5 = fma(t_1, t_2, Float64(sin(Float64(phi1 / -2.0)) * t_4))
	t_6 = Float64(t_5 * t_5)
	t_7 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_8 = sin(Float64(phi1 / 2.0))
	t_9 = Float64((Float64(t_1 * t_2) ^ 2.0) - (Float64(t_8 * t_4) ^ 2.0))
	t_10 = Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_7) * t_7)
	t_11 = sin(Float64(phi2 / 2.0))
	tmp = 0.0
	if (phi1 <= -125.0)
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64((fma((sin(Float64(-0.5 * phi2)) ^ 2.0), (cos(Float64(0.5 * phi1)) ^ 2.0), Float64(Float64(-(sin(Float64(0.5 * phi1)) ^ 2.0)) * (cos(Float64(0.5 * phi2)) ^ 2.0))) ^ 2.0) / t_6) + t_10)), sqrt(Float64(1.0 - Float64((fma(t_11, t_0, Float64(t_4 * t_8)) ^ 2.0) + t_10))))));
	elseif (phi1 <= 1.38e-14)
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_3 + t_10)), sqrt(Float64(Float64(1.0 - Float64((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) * Float64(cos(phi2) * cos(phi1)))) - t_3)))));
	else
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(Float64(t_9 * t_9) / t_6) + t_10)), sqrt(Float64(1.0 - Float64((fma(t_8, cos(Float64(phi2 / 2.0)), Float64(t_0 * t_11)) ^ 2.0) + t_10))))));
	end
	return tmp
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = (-N[Cos[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision])}, Block[{t$95$1 = N[Sin[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$4 = N[Cos[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[(t$95$1 * t$95$2 + N[(N[Sin[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(t$95$5 * t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$8 = N[Sin[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$9 = N[(N[Power[N[(t$95$1 * t$95$2), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(t$95$8 * t$95$4), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$10 = N[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$7), $MachinePrecision] * t$95$7), $MachinePrecision]}, Block[{t$95$11 = N[Sin[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -125.0], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Power[N[(N[Power[N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[((-N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]) * N[Power[N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / t$95$6), $MachinePrecision] + t$95$10), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(t$95$11 * t$95$0 + N[(t$95$4 * t$95$8), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$10), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 1.38e-14], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$3 + t$95$10), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[(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] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$3), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[(t$95$9 * t$95$9), $MachinePrecision] / t$95$6), $MachinePrecision] + t$95$10), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(t$95$8 * N[Cos[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision] + N[(t$95$0 * t$95$11), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$10), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := -\cos \left(\frac{\phi_1}{-2}\right)\\
t_1 := \sin \left(\frac{\phi_2}{-2}\right)\\
t_2 := \cos \left(\frac{\phi_1}{2}\right)\\
t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
t_4 := \cos \left(\frac{\phi_2}{-2}\right)\\
t_5 := \mathsf{fma}\left(t\_1, t\_2, \sin \left(\frac{\phi_1}{-2}\right) \cdot t\_4\right)\\
t_6 := t\_5 \cdot t\_5\\
t_7 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_8 := \sin \left(\frac{\phi_1}{2}\right)\\
t_9 := {\left(t\_1 \cdot t\_2\right)}^{2} - {\left(t\_8 \cdot t\_4\right)}^{2}\\
t_10 := \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_7\right) \cdot t\_7\\
t_11 := \sin \left(\frac{\phi_2}{2}\right)\\
\mathbf{if}\;\phi_1 \leq -125:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{t\_6} + t\_10}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(t\_11, t\_0, t\_4 \cdot t\_8\right)\right)}^{2} + t\_10\right)}}\right)\\

\mathbf{elif}\;\phi_1 \leq 1.38 \cdot 10^{-14}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_3 + t\_10}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_3}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{t\_9 \cdot t\_9}{t\_6} + t\_10}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(t\_8, \cos \left(\frac{\phi_2}{2}\right), t\_0 \cdot t\_11\right)\right)}^{2} + t\_10\right)}}\right)\\


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

    1. Initial program 43.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. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6446.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{1 - \left({\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 \color{blue}{\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. Applied rewrites46.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{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) \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      2. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6446.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{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval46.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{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      15. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      16. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
      17. lower-*.f6446.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{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites46.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{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites73.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Taylor expanded in phi1 around inf

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left({\cos \left(\frac{1}{2} \cdot \phi_1\right)}^{2} \cdot {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} - {\cos \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. lower-pow.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left({\cos \left(\frac{1}{2} \cdot \phi_1\right)}^{2} \cdot {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} - {\cos \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites73.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]

    if -125 < phi1 < 1.38000000000000002e-14

    1. Initial program 76.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
      4. associate--r+N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
      5. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    4. Applied rewrites76.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}{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    5. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      2. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      3. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\color{blue}{\lambda_1 - \lambda_2}}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      4. div-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1}{2} - \frac{\lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\cos \left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \color{blue}{\left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \color{blue}{\left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      16. lower-/.f6477.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{\left(1 - {\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 \color{blue}{\left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
    6. Applied rewrites77.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{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]

    if 1.38000000000000002e-14 < phi1

    1. Initial program 58.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. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6461.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 - \left({\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 \color{blue}{\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. Applied rewrites61.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 - \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) \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      2. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6461.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval61.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      15. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      16. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
      17. lower-*.f6461.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites61.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 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites83.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Step-by-step derivation
      1. lift-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\color{blue}{\left(\sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\right) + \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_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) \]
      2. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\color{blue}{\left(\cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right) + \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\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) \]
      3. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\color{blue}{\cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)} + \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)} + \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \cos \left(\frac{\phi_2}{-2}\right), \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \color{blue}{\cos \left(\frac{\phi_2}{-2}\right)}, \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_2}{-2}\right)\right)}, \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_2}{-2}}\right)\right), \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\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. distribute-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \cos \color{blue}{\left(\frac{\phi_2}{\mathsf{neg}\left(-2\right)}\right)}, \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\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. metadata-evalN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \cos \left(\frac{\phi_2}{\color{blue}{2}}\right), \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \cos \color{blue}{\left(\frac{\phi_2}{2}\right)}, \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right)}, \sin \left(\frac{\phi_2}{2}\right) \cdot \left(-\cos \left(\frac{\phi_1}{-2}\right)\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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \cos \left(\frac{\phi_2}{2}\right), \color{blue}{\left(-\cos \left(\frac{\phi_1}{-2}\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\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. lower-*.f6483.4

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \cos \left(\frac{\phi_2}{2}\right), \color{blue}{\left(-\cos \left(\frac{\phi_1}{-2}\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\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. Applied rewrites83.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_1}{2}\right), \cos \left(\frac{\phi_2}{2}\right), \left(-\cos \left(\frac{\phi_1}{-2}\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\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) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 3: 79.1% accurate, 0.4× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\phi_2}{-2}\right)\\ t_1 := \cos \left(\frac{\phi_1}{2}\right)\\ t_2 := \cos \left(\frac{\phi_2}{-2}\right)\\ t_3 := \mathsf{fma}\left(t\_0, t\_1, \sin \left(\frac{\phi_1}{-2}\right) \cdot t\_2\right)\\ t_4 := t\_3 \cdot t\_3\\ t_5 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_6 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_5\\ t_7 := t\_6 \cdot t\_5\\ t_8 := \sin \left(\frac{\phi_1}{2}\right)\\ t_9 := {\left(t\_0 \cdot t\_1\right)}^{2} - {\left(t\_8 \cdot t\_2\right)}^{2}\\ t_10 := {\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), t\_2 \cdot t\_8\right)\right)}^{2}\\ t_11 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ \mathbf{if}\;\phi_1 \leq -125:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{t\_4} + t\_7}}{\sqrt{1 - \left(t\_10 + t\_7\right)}}\right)\\ \mathbf{elif}\;\phi_1 \leq 1.38 \cdot 10^{-14}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_11 + t\_7}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_11}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{t\_9 \cdot t\_9}{t\_4} + t\_7}}{\sqrt{1 - \left(t\_10 + t\_6 \cdot \sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ phi2 -2.0)))
        (t_1 (cos (/ phi1 2.0)))
        (t_2 (cos (/ phi2 -2.0)))
        (t_3 (fma t_0 t_1 (* (sin (/ phi1 -2.0)) t_2)))
        (t_4 (* t_3 t_3))
        (t_5 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_6 (* (* (cos phi1) (cos phi2)) t_5))
        (t_7 (* t_6 t_5))
        (t_8 (sin (/ phi1 2.0)))
        (t_9 (- (pow (* t_0 t_1) 2.0) (pow (* t_8 t_2) 2.0)))
        (t_10
         (pow
          (fma (sin (/ phi2 2.0)) (- (cos (/ phi1 -2.0))) (* t_2 t_8))
          2.0))
        (t_11 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)))
   (if (<= phi1 -125.0)
     (*
      R
      (*
       2.0
       (atan2
        (sqrt
         (+
          (/
           (pow
            (fma
             (pow (sin (* -0.5 phi2)) 2.0)
             (pow (cos (* 0.5 phi1)) 2.0)
             (* (- (pow (sin (* 0.5 phi1)) 2.0)) (pow (cos (* 0.5 phi2)) 2.0)))
            2.0)
           t_4)
          t_7))
        (sqrt (- 1.0 (+ t_10 t_7))))))
     (if (<= phi1 1.38e-14)
       (*
        R
        (*
         2.0
         (atan2
          (sqrt (+ t_11 t_7))
          (sqrt
           (-
            (-
             1.0
             (*
              (pow
               (-
                (* (sin (/ lambda1 2.0)) (cos (/ lambda2 2.0)))
                (* (cos (/ lambda1 2.0)) (sin (/ lambda2 2.0))))
               2.0)
              (* (cos phi2) (cos phi1))))
            t_11)))))
       (*
        R
        (*
         2.0
         (atan2
          (sqrt (+ (/ (* t_9 t_9) t_4) t_7))
          (sqrt
           (- 1.0 (+ t_10 (* t_6 (sin (* (- lambda2 lambda1) -0.5)))))))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((phi2 / -2.0));
	double t_1 = cos((phi1 / 2.0));
	double t_2 = cos((phi2 / -2.0));
	double t_3 = fma(t_0, t_1, (sin((phi1 / -2.0)) * t_2));
	double t_4 = t_3 * t_3;
	double t_5 = sin(((lambda1 - lambda2) / 2.0));
	double t_6 = (cos(phi1) * cos(phi2)) * t_5;
	double t_7 = t_6 * t_5;
	double t_8 = sin((phi1 / 2.0));
	double t_9 = pow((t_0 * t_1), 2.0) - pow((t_8 * t_2), 2.0);
	double t_10 = pow(fma(sin((phi2 / 2.0)), -cos((phi1 / -2.0)), (t_2 * t_8)), 2.0);
	double t_11 = pow(sin(((phi1 - phi2) / 2.0)), 2.0);
	double tmp;
	if (phi1 <= -125.0) {
		tmp = R * (2.0 * atan2(sqrt(((pow(fma(pow(sin((-0.5 * phi2)), 2.0), pow(cos((0.5 * phi1)), 2.0), (-pow(sin((0.5 * phi1)), 2.0) * pow(cos((0.5 * phi2)), 2.0))), 2.0) / t_4) + t_7)), sqrt((1.0 - (t_10 + t_7)))));
	} else if (phi1 <= 1.38e-14) {
		tmp = R * (2.0 * atan2(sqrt((t_11 + t_7)), sqrt(((1.0 - (pow(((sin((lambda1 / 2.0)) * cos((lambda2 / 2.0))) - (cos((lambda1 / 2.0)) * sin((lambda2 / 2.0)))), 2.0) * (cos(phi2) * cos(phi1)))) - t_11))));
	} else {
		tmp = R * (2.0 * atan2(sqrt((((t_9 * t_9) / t_4) + t_7)), sqrt((1.0 - (t_10 + (t_6 * sin(((lambda2 - lambda1) * -0.5))))))));
	}
	return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(phi2 / -2.0))
	t_1 = cos(Float64(phi1 / 2.0))
	t_2 = cos(Float64(phi2 / -2.0))
	t_3 = fma(t_0, t_1, Float64(sin(Float64(phi1 / -2.0)) * t_2))
	t_4 = Float64(t_3 * t_3)
	t_5 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_6 = Float64(Float64(cos(phi1) * cos(phi2)) * t_5)
	t_7 = Float64(t_6 * t_5)
	t_8 = sin(Float64(phi1 / 2.0))
	t_9 = Float64((Float64(t_0 * t_1) ^ 2.0) - (Float64(t_8 * t_2) ^ 2.0))
	t_10 = fma(sin(Float64(phi2 / 2.0)), Float64(-cos(Float64(phi1 / -2.0))), Float64(t_2 * t_8)) ^ 2.0
	t_11 = sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0
	tmp = 0.0
	if (phi1 <= -125.0)
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64((fma((sin(Float64(-0.5 * phi2)) ^ 2.0), (cos(Float64(0.5 * phi1)) ^ 2.0), Float64(Float64(-(sin(Float64(0.5 * phi1)) ^ 2.0)) * (cos(Float64(0.5 * phi2)) ^ 2.0))) ^ 2.0) / t_4) + t_7)), sqrt(Float64(1.0 - Float64(t_10 + t_7))))));
	elseif (phi1 <= 1.38e-14)
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_11 + t_7)), sqrt(Float64(Float64(1.0 - Float64((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) * Float64(cos(phi2) * cos(phi1)))) - t_11)))));
	else
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(Float64(Float64(t_9 * t_9) / t_4) + t_7)), sqrt(Float64(1.0 - Float64(t_10 + Float64(t_6 * sin(Float64(Float64(lambda2 - lambda1) * -0.5)))))))));
	end
	return tmp
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(t$95$0 * t$95$1 + N[(N[Sin[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[(t$95$3 * t$95$3), $MachinePrecision]}, Block[{t$95$5 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[(t$95$6 * t$95$5), $MachinePrecision]}, Block[{t$95$8 = N[Sin[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$9 = N[(N[Power[N[(t$95$0 * t$95$1), $MachinePrecision], 2.0], $MachinePrecision] - N[Power[N[(t$95$8 * t$95$2), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$10 = N[Power[N[(N[Sin[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision] * (-N[Cos[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision]) + N[(t$95$2 * t$95$8), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$11 = N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, If[LessEqual[phi1, -125.0], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[Power[N[(N[Power[N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[((-N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]) * N[Power[N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / t$95$4), $MachinePrecision] + t$95$7), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$10 + t$95$7), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 1.38e-14], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$11 + t$95$7), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[(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] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$11), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[(N[(t$95$9 * t$95$9), $MachinePrecision] / t$95$4), $MachinePrecision] + t$95$7), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$10 + N[(t$95$6 * N[Sin[N[(N[(lambda2 - lambda1), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\phi_2}{-2}\right)\\
t_1 := \cos \left(\frac{\phi_1}{2}\right)\\
t_2 := \cos \left(\frac{\phi_2}{-2}\right)\\
t_3 := \mathsf{fma}\left(t\_0, t\_1, \sin \left(\frac{\phi_1}{-2}\right) \cdot t\_2\right)\\
t_4 := t\_3 \cdot t\_3\\
t_5 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_6 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_5\\
t_7 := t\_6 \cdot t\_5\\
t_8 := \sin \left(\frac{\phi_1}{2}\right)\\
t_9 := {\left(t\_0 \cdot t\_1\right)}^{2} - {\left(t\_8 \cdot t\_2\right)}^{2}\\
t_10 := {\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), t\_2 \cdot t\_8\right)\right)}^{2}\\
t_11 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
\mathbf{if}\;\phi_1 \leq -125:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{t\_4} + t\_7}}{\sqrt{1 - \left(t\_10 + t\_7\right)}}\right)\\

\mathbf{elif}\;\phi_1 \leq 1.38 \cdot 10^{-14}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_11 + t\_7}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_11}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{t\_9 \cdot t\_9}{t\_4} + t\_7}}{\sqrt{1 - \left(t\_10 + t\_6 \cdot \sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)\right)}}\right)\\


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

    1. Initial program 43.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. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6446.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{1 - \left({\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 \color{blue}{\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. Applied rewrites46.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{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) \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      2. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6446.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{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval46.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{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      15. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      16. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
      17. lower-*.f6446.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{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites46.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{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites73.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Taylor expanded in phi1 around inf

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left({\cos \left(\frac{1}{2} \cdot \phi_1\right)}^{2} \cdot {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} - {\cos \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. lower-pow.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left({\cos \left(\frac{1}{2} \cdot \phi_1\right)}^{2} \cdot {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} - {\cos \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites73.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]

    if -125 < phi1 < 1.38000000000000002e-14

    1. Initial program 76.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
      4. associate--r+N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
      5. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    4. Applied rewrites76.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}{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    5. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      2. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      3. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\color{blue}{\lambda_1 - \lambda_2}}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      4. div-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1}{2} - \frac{\lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\cos \left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \color{blue}{\left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \color{blue}{\left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      16. lower-/.f6477.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{\left(1 - {\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 \color{blue}{\left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
    6. Applied rewrites77.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{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]

    if 1.38000000000000002e-14 < phi1

    1. Initial program 58.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. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6461.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 - \left({\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 \color{blue}{\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. Applied rewrites61.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 - \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) \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      2. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6461.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval61.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      15. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      16. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
      17. lower-*.f6461.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites61.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 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites83.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Taylor expanded in lambda1 around -inf

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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 \color{blue}{\sin \left(\frac{-1}{2} \cdot \left(\lambda_2 + -1 \cdot \lambda_1\right)\right)}\right)}}\right) \]
    9. Step-by-step derivation
      1. fp-cancel-sign-sub-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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{-1}{2} \cdot \color{blue}{\left(\lambda_2 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \lambda_1\right)}\right)\right)}}\right) \]
      2. metadata-evalN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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{-1}{2} \cdot \left(\lambda_2 - \color{blue}{1} \cdot \lambda_1\right)\right)\right)}}\right) \]
      3. *-lft-identityN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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{-1}{2} \cdot \left(\lambda_2 - \color{blue}{\lambda_1}\right)\right)\right)}}\right) \]
      4. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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 \color{blue}{\sin \left(\frac{-1}{2} \cdot \left(\lambda_2 - \lambda_1\right)\right)}\right)}}\right) \]
      5. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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 \color{blue}{\left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}\right)}}\right) \]
      6. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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 \color{blue}{\left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}\right)}}\right) \]
      7. lower--.f6483.4

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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(\color{blue}{\left(\lambda_2 - \lambda_1\right)} \cdot -0.5\right)\right)}}\right) \]
    10. Applied rewrites83.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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 \color{blue}{\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}\right)}}\right) \]
  3. Recombined 3 regimes into one program.
  4. Add Preprocessing

Alternative 4: 79.1% accurate, 0.4× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_4 + t\_2}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_4}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi1 < -125 or 1.38000000000000002e-14 < phi1

    1. Initial program 52.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. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6455.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 - \left({\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 \color{blue}{\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. Applied rewrites55.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 - \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) \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      2. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6455.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval55.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      15. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      16. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
      17. lower-*.f6455.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites55.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 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites79.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Taylor expanded in phi1 around inf

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left({\cos \left(\frac{1}{2} \cdot \phi_1\right)}^{2} \cdot {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} - {\cos \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. lower-pow.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left({\cos \left(\frac{1}{2} \cdot \phi_1\right)}^{2} \cdot {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} - {\cos \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites79.3%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{\color{blue}{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]

    if -125 < phi1 < 1.38000000000000002e-14

    1. Initial program 76.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
      4. associate--r+N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
      5. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    4. Applied rewrites76.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}{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    5. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      2. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      3. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\color{blue}{\lambda_1 - \lambda_2}}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      4. div-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1}{2} - \frac{\lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\cos \left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \color{blue}{\left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \color{blue}{\left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      16. lower-/.f6477.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{\left(1 - {\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 \color{blue}{\left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
    6. Applied rewrites77.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{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification78.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -125 \lor \neg \left(\phi_1 \leq 1.38 \cdot 10^{-14}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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)\\ \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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 5: 69.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(-0.5 \cdot \phi_2\right)\\ t_1 := \cos \left(0.5 \cdot \phi_1\right)\\ t_2 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_3 := \cos \left(0.5 \cdot \phi_2\right)\\ t_4 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_5 := \cos \phi_1 \cdot \cos \phi_2\\ t_6 := \left(t\_5 \cdot t\_2\right) \cdot t\_2\\ \mathbf{if}\;\phi_2 \leq -1.1 \cdot 10^{+24} \lor \neg \left(\phi_2 \leq 27000000\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_5, {\sin \left(0.5 \cdot \lambda_1\right)}^{2}, \frac{{\left(\mathsf{fma}\left({t\_0}^{2}, {t\_1}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {t\_3}^{2}\right)\right)}^{2}}{{\left(\mathsf{fma}\left(\sin \left(-0.5 \cdot \phi_1\right), t\_3, t\_0 \cdot t\_1\right)\right)}^{2}}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)\right)}^{2} + t\_6\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_4 + t\_6}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_4}}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (* -0.5 phi2)))
        (t_1 (cos (* 0.5 phi1)))
        (t_2 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_3 (cos (* 0.5 phi2)))
        (t_4 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0))
        (t_5 (* (cos phi1) (cos phi2)))
        (t_6 (* (* t_5 t_2) t_2)))
   (if (or (<= phi2 -1.1e+24) (not (<= phi2 27000000.0)))
     (*
      R
      (*
       2.0
       (atan2
        (sqrt
         (fma
          t_5
          (pow (sin (* 0.5 lambda1)) 2.0)
          (/
           (pow
            (fma
             (pow t_0 2.0)
             (pow t_1 2.0)
             (* (- (pow (sin (* 0.5 phi1)) 2.0)) (pow t_3 2.0)))
            2.0)
           (pow (fma (sin (* -0.5 phi1)) t_3 (* t_0 t_1)) 2.0))))
        (sqrt
         (-
          1.0
          (+
           (pow
            (fma
             (sin (/ phi2 2.0))
             (- (cos (/ phi1 -2.0)))
             (* (cos (/ phi2 -2.0)) (sin (/ phi1 2.0))))
            2.0)
           t_6))))))
     (*
      R
      (*
       2.0
       (atan2
        (sqrt (+ t_4 t_6))
        (sqrt
         (-
          (-
           1.0
           (*
            (pow
             (-
              (* (sin (/ lambda1 2.0)) (cos (/ lambda2 2.0)))
              (* (cos (/ lambda1 2.0)) (sin (/ lambda2 2.0))))
             2.0)
            (* (cos phi2) (cos phi1))))
          t_4))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((-0.5 * phi2));
	double t_1 = cos((0.5 * phi1));
	double t_2 = sin(((lambda1 - lambda2) / 2.0));
	double t_3 = cos((0.5 * phi2));
	double t_4 = pow(sin(((phi1 - phi2) / 2.0)), 2.0);
	double t_5 = cos(phi1) * cos(phi2);
	double t_6 = (t_5 * t_2) * t_2;
	double tmp;
	if ((phi2 <= -1.1e+24) || !(phi2 <= 27000000.0)) {
		tmp = R * (2.0 * atan2(sqrt(fma(t_5, pow(sin((0.5 * lambda1)), 2.0), (pow(fma(pow(t_0, 2.0), pow(t_1, 2.0), (-pow(sin((0.5 * phi1)), 2.0) * pow(t_3, 2.0))), 2.0) / pow(fma(sin((-0.5 * phi1)), t_3, (t_0 * t_1)), 2.0)))), sqrt((1.0 - (pow(fma(sin((phi2 / 2.0)), -cos((phi1 / -2.0)), (cos((phi2 / -2.0)) * sin((phi1 / 2.0)))), 2.0) + t_6)))));
	} else {
		tmp = R * (2.0 * atan2(sqrt((t_4 + t_6)), sqrt(((1.0 - (pow(((sin((lambda1 / 2.0)) * cos((lambda2 / 2.0))) - (cos((lambda1 / 2.0)) * sin((lambda2 / 2.0)))), 2.0) * (cos(phi2) * cos(phi1)))) - t_4))));
	}
	return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(-0.5 * phi2))
	t_1 = cos(Float64(0.5 * phi1))
	t_2 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_3 = cos(Float64(0.5 * phi2))
	t_4 = sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0
	t_5 = Float64(cos(phi1) * cos(phi2))
	t_6 = Float64(Float64(t_5 * t_2) * t_2)
	tmp = 0.0
	if ((phi2 <= -1.1e+24) || !(phi2 <= 27000000.0))
		tmp = Float64(R * Float64(2.0 * atan(sqrt(fma(t_5, (sin(Float64(0.5 * lambda1)) ^ 2.0), Float64((fma((t_0 ^ 2.0), (t_1 ^ 2.0), Float64(Float64(-(sin(Float64(0.5 * phi1)) ^ 2.0)) * (t_3 ^ 2.0))) ^ 2.0) / (fma(sin(Float64(-0.5 * phi1)), t_3, Float64(t_0 * t_1)) ^ 2.0)))), sqrt(Float64(1.0 - Float64((fma(sin(Float64(phi2 / 2.0)), Float64(-cos(Float64(phi1 / -2.0))), Float64(cos(Float64(phi2 / -2.0)) * sin(Float64(phi1 / 2.0)))) ^ 2.0) + t_6))))));
	else
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_4 + t_6)), sqrt(Float64(Float64(1.0 - Float64((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) * Float64(cos(phi2) * cos(phi1)))) - t_4)))));
	end
	return tmp
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[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[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$5 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$5 * t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision]}, If[Or[LessEqual[phi2, -1.1e+24], N[Not[LessEqual[phi2, 27000000.0]], $MachinePrecision]], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$5 * N[Power[N[Sin[N[(0.5 * lambda1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[Power[t$95$1, 2.0], $MachinePrecision] + N[((-N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]) * N[Power[t$95$3, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[(N[Sin[N[(-0.5 * phi1), $MachinePrecision]], $MachinePrecision] * t$95$3 + N[(t$95$0 * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(N[Sin[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision] * (-N[Cos[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision]) + N[(N[Cos[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$6), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$4 + t$95$6), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[(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] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$4), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(-0.5 \cdot \phi_2\right)\\
t_1 := \cos \left(0.5 \cdot \phi_1\right)\\
t_2 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_3 := \cos \left(0.5 \cdot \phi_2\right)\\
t_4 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
t_5 := \cos \phi_1 \cdot \cos \phi_2\\
t_6 := \left(t\_5 \cdot t\_2\right) \cdot t\_2\\
\mathbf{if}\;\phi_2 \leq -1.1 \cdot 10^{+24} \lor \neg \left(\phi_2 \leq 27000000\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_5, {\sin \left(0.5 \cdot \lambda_1\right)}^{2}, \frac{{\left(\mathsf{fma}\left({t\_0}^{2}, {t\_1}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {t\_3}^{2}\right)\right)}^{2}}{{\left(\mathsf{fma}\left(\sin \left(-0.5 \cdot \phi_1\right), t\_3, t\_0 \cdot t\_1\right)\right)}^{2}}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)\right)}^{2} + t\_6\right)}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_4 + t\_6}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_4}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi2 < -1.10000000000000001e24 or 2.7e7 < phi2

    1. Initial program 41.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. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6444.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(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \color{blue}{\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. Applied rewrites44.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(\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) \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      2. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6444.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(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval44.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(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      15. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      16. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
      17. lower-*.f6444.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(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites44.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(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites72.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Taylor expanded in lambda2 around 0

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(\frac{1}{2} \cdot \lambda_1\right)}^{2}\right) + \frac{{\left({\cos \left(\frac{1}{2} \cdot \phi_1\right)}^{2} \cdot {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} - {\cos \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}^{2}}{{\left(\cos \left(\frac{-1}{2} \cdot \phi_2\right) \cdot \sin \left(\frac{-1}{2} \cdot \phi_1\right) + \cos \left(\frac{1}{2} \cdot \phi_1\right) \cdot \sin \left(\frac{-1}{2} \cdot \phi_2\right)\right)}^{2}}}}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites60.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(0.5 \cdot \lambda_1\right)}^{2}, \frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{{\left(\mathsf{fma}\left(\sin \left(-0.5 \cdot \phi_1\right), \cos \left(0.5 \cdot \phi_2\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}}\right)}}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]

    if -1.10000000000000001e24 < phi2 < 2.7e7

    1. Initial program 80.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. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
      4. associate--r+N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
      5. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    4. Applied rewrites80.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 \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
    5. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      2. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1 - \lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      3. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\color{blue}{\lambda_1 - \lambda_2}}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      4. div-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{\lambda_1}{2} - \frac{\lambda_2}{2}\right)}}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \color{blue}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\cos \left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \color{blue}{\left(\frac{\lambda_2}{2}\right)} - \cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right) \cdot \sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \color{blue}{\cos \left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \color{blue}{\left(\frac{\lambda_1}{2}\right)} \cdot \sin \left(\frac{\lambda_2}{2}\right)\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - {\left(\sin \left(\frac{\lambda_1}{2}\right) \cdot \cos \left(\frac{\lambda_2}{2}\right) - \cos \left(\frac{\lambda_1}{2}\right) \cdot \color{blue}{\sin \left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
      16. lower-/.f6480.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 - {\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 \color{blue}{\left(\frac{\lambda_2}{2}\right)}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
    6. Applied rewrites80.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}{\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification72.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -1.1 \cdot 10^{+24} \lor \neg \left(\phi_2 \leq 27000000\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(0.5 \cdot \lambda_1\right)}^{2}, \frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{{\left(\mathsf{fma}\left(\sin \left(-0.5 \cdot \phi_1\right), \cos \left(0.5 \cdot \phi_2\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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)\\ \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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\left(1 - {\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} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right)\\ \end{array} \]
  5. Add Preprocessing

Alternative 6: 68.2% accurate, 0.5× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\phi_2}{2}\right)\\ t_1 := \cos \left(0.5 \cdot \phi_1\right)\\ t_2 := \cos \left(0.5 \cdot \phi_2\right)\\ t_3 := \cos \phi_1 \cdot \cos \phi_2\\ t_4 := \sin \left(-0.5 \cdot \phi_2\right)\\ t_5 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_6 := \left(t\_3 \cdot t\_5\right) \cdot t\_5\\ t_7 := \sin \left(\frac{\phi_1}{2}\right)\\ \mathbf{if}\;\lambda_1 \leq -4.8 \cdot 10^{-178} \lor \neg \left(\lambda_1 \leq 10^{-29}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_6}}{\sqrt{1 - \left({\left(t\_7 \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot t\_0\right)}^{2} + t\_6\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_3, {\sin \left(-0.5 \cdot \lambda_2\right)}^{2}, \frac{{\left(\mathsf{fma}\left({t\_4}^{2}, {t\_1}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {t\_2}^{2}\right)\right)}^{2}}{{\left(\mathsf{fma}\left(\sin \left(-0.5 \cdot \phi_1\right), t\_2, t\_4 \cdot t\_1\right)\right)}^{2}}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(t\_0, -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot t\_7\right)\right)}^{2} + t\_6\right)}}\right)\\ \end{array} \end{array} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (/ phi2 2.0)))
        (t_1 (cos (* 0.5 phi1)))
        (t_2 (cos (* 0.5 phi2)))
        (t_3 (* (cos phi1) (cos phi2)))
        (t_4 (sin (* -0.5 phi2)))
        (t_5 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_6 (* (* t_3 t_5) t_5))
        (t_7 (sin (/ phi1 2.0))))
   (if (or (<= lambda1 -4.8e-178) (not (<= lambda1 1e-29)))
     (*
      R
      (*
       2.0
       (atan2
        (sqrt (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) t_6))
        (sqrt
         (-
          1.0
          (+
           (pow (- (* t_7 (cos (/ phi2 2.0))) (* (cos (/ phi1 2.0)) t_0)) 2.0)
           t_6))))))
     (*
      R
      (*
       2.0
       (atan2
        (sqrt
         (fma
          t_3
          (pow (sin (* -0.5 lambda2)) 2.0)
          (/
           (pow
            (fma
             (pow t_4 2.0)
             (pow t_1 2.0)
             (* (- (pow (sin (* 0.5 phi1)) 2.0)) (pow t_2 2.0)))
            2.0)
           (pow (fma (sin (* -0.5 phi1)) t_2 (* t_4 t_1)) 2.0))))
        (sqrt
         (-
          1.0
          (+
           (pow
            (fma t_0 (- (cos (/ phi1 -2.0))) (* (cos (/ phi2 -2.0)) t_7))
            2.0)
           t_6)))))))))
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((phi2 / 2.0));
	double t_1 = cos((0.5 * phi1));
	double t_2 = cos((0.5 * phi2));
	double t_3 = cos(phi1) * cos(phi2);
	double t_4 = sin((-0.5 * phi2));
	double t_5 = sin(((lambda1 - lambda2) / 2.0));
	double t_6 = (t_3 * t_5) * t_5;
	double t_7 = sin((phi1 / 2.0));
	double tmp;
	if ((lambda1 <= -4.8e-178) || !(lambda1 <= 1e-29)) {
		tmp = R * (2.0 * atan2(sqrt((pow(sin(((phi1 - phi2) / 2.0)), 2.0) + t_6)), sqrt((1.0 - (pow(((t_7 * cos((phi2 / 2.0))) - (cos((phi1 / 2.0)) * t_0)), 2.0) + t_6)))));
	} else {
		tmp = R * (2.0 * atan2(sqrt(fma(t_3, pow(sin((-0.5 * lambda2)), 2.0), (pow(fma(pow(t_4, 2.0), pow(t_1, 2.0), (-pow(sin((0.5 * phi1)), 2.0) * pow(t_2, 2.0))), 2.0) / pow(fma(sin((-0.5 * phi1)), t_2, (t_4 * t_1)), 2.0)))), sqrt((1.0 - (pow(fma(t_0, -cos((phi1 / -2.0)), (cos((phi2 / -2.0)) * t_7)), 2.0) + t_6)))));
	}
	return tmp;
}
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(phi2 / 2.0))
	t_1 = cos(Float64(0.5 * phi1))
	t_2 = cos(Float64(0.5 * phi2))
	t_3 = Float64(cos(phi1) * cos(phi2))
	t_4 = sin(Float64(-0.5 * phi2))
	t_5 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_6 = Float64(Float64(t_3 * t_5) * t_5)
	t_7 = sin(Float64(phi1 / 2.0))
	tmp = 0.0
	if ((lambda1 <= -4.8e-178) || !(lambda1 <= 1e-29))
		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + t_6)), sqrt(Float64(1.0 - Float64((Float64(Float64(t_7 * cos(Float64(phi2 / 2.0))) - Float64(cos(Float64(phi1 / 2.0)) * t_0)) ^ 2.0) + t_6))))));
	else
		tmp = Float64(R * Float64(2.0 * atan(sqrt(fma(t_3, (sin(Float64(-0.5 * lambda2)) ^ 2.0), Float64((fma((t_4 ^ 2.0), (t_1 ^ 2.0), Float64(Float64(-(sin(Float64(0.5 * phi1)) ^ 2.0)) * (t_2 ^ 2.0))) ^ 2.0) / (fma(sin(Float64(-0.5 * phi1)), t_2, Float64(t_4 * t_1)) ^ 2.0)))), sqrt(Float64(1.0 - Float64((fma(t_0, Float64(-cos(Float64(phi1 / -2.0))), Float64(cos(Float64(phi2 / -2.0)) * t_7)) ^ 2.0) + t_6))))));
	end
	return tmp
end
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(0.5 * phi2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$4 = N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[(N[(t$95$3 * t$95$5), $MachinePrecision] * t$95$5), $MachinePrecision]}, Block[{t$95$7 = N[Sin[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[lambda1, -4.8e-178], N[Not[LessEqual[lambda1, 1e-29]], $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] + t$95$6), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(t$95$7 * N[Cos[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$6), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$3 * N[Power[N[Sin[N[(-0.5 * lambda2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[Power[N[(N[Power[t$95$4, 2.0], $MachinePrecision] * N[Power[t$95$1, 2.0], $MachinePrecision] + N[((-N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]) * N[Power[t$95$2, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] / N[Power[N[(N[Sin[N[(-0.5 * phi1), $MachinePrecision]], $MachinePrecision] * t$95$2 + N[(t$95$4 * t$95$1), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(t$95$0 * (-N[Cos[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision]) + N[(N[Cos[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision] * t$95$7), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision] + t$95$6), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\phi_2}{2}\right)\\
t_1 := \cos \left(0.5 \cdot \phi_1\right)\\
t_2 := \cos \left(0.5 \cdot \phi_2\right)\\
t_3 := \cos \phi_1 \cdot \cos \phi_2\\
t_4 := \sin \left(-0.5 \cdot \phi_2\right)\\
t_5 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_6 := \left(t\_3 \cdot t\_5\right) \cdot t\_5\\
t_7 := \sin \left(\frac{\phi_1}{2}\right)\\
\mathbf{if}\;\lambda_1 \leq -4.8 \cdot 10^{-178} \lor \neg \left(\lambda_1 \leq 10^{-29}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_6}}{\sqrt{1 - \left({\left(t\_7 \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot t\_0\right)}^{2} + t\_6\right)}}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda1 < -4.8000000000000001e-178 or 9.99999999999999943e-30 < lambda1

    1. Initial program 58.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. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6459.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 - \left({\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 \color{blue}{\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. Applied rewrites59.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 - \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) \]

    if -4.8000000000000001e-178 < lambda1 < 9.99999999999999943e-30

    1. Initial program 79.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. Add Preprocessing
    3. Step-by-step derivation
      1. lift-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      5. sin-diffN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      6. lower--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      7. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      8. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
      9. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
      10. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      11. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
      12. lower-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      13. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
      14. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
      15. lower-sin.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
      16. lower-/.f6481.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\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 \color{blue}{\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. Applied rewrites81.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(\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) \]
    5. Step-by-step derivation
      1. lift--.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
      2. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6481.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval81.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      15. lift-*.f64N/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
      16. *-commutativeN/A

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
      17. lower-*.f6481.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites81.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites97.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right) \cdot \left({\left(\sin \left(\frac{\phi_2}{-2}\right) \cdot \cos \left(\frac{\phi_1}{2}\right)\right)}^{2} - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right)}^{2}\right)}{\mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-2}\right)\right) \cdot \mathsf{fma}\left(\sin \left(\frac{\phi_2}{-2}\right), \cos \left(\frac{\phi_1}{2}\right), \sin \left(\frac{\phi_1}{-2}\right) \cdot \cos \left(\frac{\phi_2}{-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)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Taylor expanded in lambda1 around 0

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}\right) + \frac{{\left({\cos \left(\frac{1}{2} \cdot \phi_1\right)}^{2} \cdot {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} - {\cos \left(\frac{-1}{2} \cdot \phi_2\right)}^{2} \cdot {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}^{2}}{{\left(\cos \left(\frac{-1}{2} \cdot \phi_2\right) \cdot \sin \left(\frac{-1}{2} \cdot \phi_1\right) + \cos \left(\frac{1}{2} \cdot \phi_1\right) \cdot \sin \left(\frac{-1}{2} \cdot \phi_2\right)\right)}^{2}}}}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites97.7%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(-0.5 \cdot \lambda_2\right)}^{2}, \frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{{\left(\mathsf{fma}\left(\sin \left(-0.5 \cdot \phi_1\right), \cos \left(0.5 \cdot \phi_2\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}}\right)}}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification70.4%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\lambda_1 \leq -4.8 \cdot 10^{-178} \lor \neg \left(\lambda_1 \leq 10^{-29}\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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\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)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(-0.5 \cdot \lambda_2\right)}^{2}, \frac{{\left(\mathsf{fma}\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}, \left(-{\sin \left(0.5 \cdot \phi_1\right)}^{2}\right) \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)}^{2}}{{\left(\mathsf{fma}\left(\sin \left(-0.5 \cdot \phi_1\right), \cos \left(0.5 \cdot \phi_2\right), \sin \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(0.5 \cdot \phi_1\right)\right)\right)}^{2}}\right)}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 7: 46.7% accurate, 0.6× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if (*.f64 #s(literal 2 binary64) (atan2.f64 (sqrt.f64 (+.f64 (pow.f64 (sin.f64 (/.f64 (-.f64 phi1 phi2) #s(literal 2 binary64))) #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 (cos.f64 phi1) (cos.f64 phi2)) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))))) (sqrt.f64 (-.f64 #s(literal 1 binary64) (+.f64 (pow.f64 (sin.f64 (/.f64 (-.f64 phi1 phi2) #s(literal 2 binary64))) #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 (cos.f64 phi1) (cos.f64 phi2)) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64))))))))) < 9.99999999999999939e-12

    1. Initial program 100.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
    4. Applied rewrites100.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_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
    5. Taylor expanded in phi2 around 0

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
      2. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\color{blue}{\cos \phi_1} \cdot \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
        6. lower-cos.f64N/A

          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \color{blue}{\cos \phi_2}, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
        7. lower-pow.f64N/A

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

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

          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \color{blue}{\left(\frac{-1}{2} \cdot \lambda_2\right)}}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
        10. lower-pow.f64N/A

          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, \color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
        11. lower-sin.f64N/A

          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\color{blue}{\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
        12. lower-*.f64N/A

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

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

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

      if 9.99999999999999939e-12 < (*.f64 #s(literal 2 binary64) (atan2.f64 (sqrt.f64 (+.f64 (pow.f64 (sin.f64 (/.f64 (-.f64 phi1 phi2) #s(literal 2 binary64))) #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 (cos.f64 phi1) (cos.f64 phi2)) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))))) (sqrt.f64 (-.f64 #s(literal 1 binary64) (+.f64 (pow.f64 (sin.f64 (/.f64 (-.f64 phi1 phi2) #s(literal 2 binary64))) #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 (cos.f64 phi1) (cos.f64 phi2)) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))))))))

      1. Initial program 62.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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
      4. Applied rewrites52.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} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
      5. Taylor expanded in phi2 around 0

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

          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
        2. lower-fma.f64N/A

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

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

          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}{\sqrt{\mathsf{fma}\left(-{\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}, \color{blue}{\cos \phi_1}, {\cos \left(0.5 \cdot \phi_1\right)}^{2}\right)}}\right) \]
      9. Recombined 2 regimes into one program.
      10. Add Preprocessing

      Alternative 8: 46.7% accurate, 0.6× speedup?

      \[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}\\ t_1 := \cos \phi_1 \cdot \cos \phi_2\\ t_2 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(t\_1 \cdot t\_2\right) \cdot t\_2\\ \mathbf{if}\;2 \cdot \tan^{-1}_* \frac{\sqrt{t\_3}}{\sqrt{1 - t\_3}} \leq 10^{-11}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_1, {\sin \left(-0.5 \cdot \lambda_2\right)}^{2}, {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}{\sqrt{1 - t\_0}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_0, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - t\_0 \cdot \cos \phi_1}}\right)\\ \end{array} \end{array} \]
      (FPCore (R lambda1 lambda2 phi1 phi2)
       :precision binary64
       (let* ((t_0 (pow (sin (* (- lambda2 lambda1) -0.5)) 2.0))
              (t_1 (* (cos phi1) (cos phi2)))
              (t_2 (sin (/ (- lambda1 lambda2) 2.0)))
              (t_3 (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) (* (* t_1 t_2) t_2))))
         (if (<= (* 2.0 (atan2 (sqrt t_3) (sqrt (- 1.0 t_3)))) 1e-11)
           (*
            R
            (*
             2.0
             (atan2
              (sqrt
               (fma
                t_1
                (pow (sin (* -0.5 lambda2)) 2.0)
                (pow (sin (* 0.5 (- phi1 phi2))) 2.0)))
              (sqrt (- 1.0 t_0)))))
           (*
            R
            (*
             2.0
             (atan2
              (sqrt (fma t_0 (cos phi1) (pow (sin (* 0.5 phi1)) 2.0)))
              (sqrt (- (pow (cos (* -0.5 phi1)) 2.0) (* t_0 (cos phi1))))))))))
      double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
      	double t_0 = pow(sin(((lambda2 - lambda1) * -0.5)), 2.0);
      	double t_1 = cos(phi1) * cos(phi2);
      	double t_2 = sin(((lambda1 - lambda2) / 2.0));
      	double t_3 = pow(sin(((phi1 - phi2) / 2.0)), 2.0) + ((t_1 * t_2) * t_2);
      	double tmp;
      	if ((2.0 * atan2(sqrt(t_3), sqrt((1.0 - t_3)))) <= 1e-11) {
      		tmp = R * (2.0 * atan2(sqrt(fma(t_1, pow(sin((-0.5 * lambda2)), 2.0), pow(sin((0.5 * (phi1 - phi2))), 2.0))), sqrt((1.0 - t_0))));
      	} else {
      		tmp = R * (2.0 * atan2(sqrt(fma(t_0, cos(phi1), pow(sin((0.5 * phi1)), 2.0))), sqrt((pow(cos((-0.5 * phi1)), 2.0) - (t_0 * cos(phi1))))));
      	}
      	return tmp;
      }
      
      function code(R, lambda1, lambda2, phi1, phi2)
      	t_0 = sin(Float64(Float64(lambda2 - lambda1) * -0.5)) ^ 2.0
      	t_1 = Float64(cos(phi1) * cos(phi2))
      	t_2 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
      	t_3 = Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(t_1 * t_2) * t_2))
      	tmp = 0.0
      	if (Float64(2.0 * atan(sqrt(t_3), sqrt(Float64(1.0 - t_3)))) <= 1e-11)
      		tmp = Float64(R * Float64(2.0 * atan(sqrt(fma(t_1, (sin(Float64(-0.5 * lambda2)) ^ 2.0), (sin(Float64(0.5 * Float64(phi1 - phi2))) ^ 2.0))), sqrt(Float64(1.0 - t_0)))));
      	else
      		tmp = Float64(R * Float64(2.0 * atan(sqrt(fma(t_0, cos(phi1), (sin(Float64(0.5 * phi1)) ^ 2.0))), sqrt(Float64((cos(Float64(-0.5 * phi1)) ^ 2.0) - Float64(t_0 * cos(phi1)))))));
      	end
      	return tmp
      end
      
      code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(N[(lambda2 - lambda1), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[(N[(t$95$1 * t$95$2), $MachinePrecision] * t$95$2), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(2.0 * N[ArcTan[N[Sqrt[t$95$3], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$3), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1e-11], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 * N[Power[N[Sin[N[(-0.5 * lambda2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] + N[Power[N[Sin[N[(0.5 * N[(phi1 - phi2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - t$95$0), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$0 * N[Cos[phi1], $MachinePrecision] + N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[Power[N[Cos[N[(-0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - N[(t$95$0 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
      
      \begin{array}{l}
      
      \\
      \begin{array}{l}
      t_0 := {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}\\
      t_1 := \cos \phi_1 \cdot \cos \phi_2\\
      t_2 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
      t_3 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(t\_1 \cdot t\_2\right) \cdot t\_2\\
      \mathbf{if}\;2 \cdot \tan^{-1}_* \frac{\sqrt{t\_3}}{\sqrt{1 - t\_3}} \leq 10^{-11}:\\
      \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_1, {\sin \left(-0.5 \cdot \lambda_2\right)}^{2}, {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}{\sqrt{1 - t\_0}}\right)\\
      
      \mathbf{else}:\\
      \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_0, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - t\_0 \cdot \cos \phi_1}}\right)\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if (*.f64 #s(literal 2 binary64) (atan2.f64 (sqrt.f64 (+.f64 (pow.f64 (sin.f64 (/.f64 (-.f64 phi1 phi2) #s(literal 2 binary64))) #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 (cos.f64 phi1) (cos.f64 phi2)) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))))) (sqrt.f64 (-.f64 #s(literal 1 binary64) (+.f64 (pow.f64 (sin.f64 (/.f64 (-.f64 phi1 phi2) #s(literal 2 binary64))) #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 (cos.f64 phi1) (cos.f64 phi2)) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64))))))))) < 9.99999999999999939e-12

        1. Initial program 100.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
        4. Applied rewrites100.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_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
        5. Taylor expanded in phi2 around 0

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

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
          2. lower-fma.f64N/A

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

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

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

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

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

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

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

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

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

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\color{blue}{\cos \phi_1} \cdot \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
            6. lower-cos.f64N/A

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \color{blue}{\cos \phi_2}, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
            7. lower-pow.f64N/A

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

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

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \color{blue}{\left(\frac{-1}{2} \cdot \lambda_2\right)}}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
            10. lower-pow.f64N/A

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, \color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
            11. lower-sin.f64N/A

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\color{blue}{\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
            12. lower-*.f64N/A

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

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

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

          if 9.99999999999999939e-12 < (*.f64 #s(literal 2 binary64) (atan2.f64 (sqrt.f64 (+.f64 (pow.f64 (sin.f64 (/.f64 (-.f64 phi1 phi2) #s(literal 2 binary64))) #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 (cos.f64 phi1) (cos.f64 phi2)) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))))) (sqrt.f64 (-.f64 #s(literal 1 binary64) (+.f64 (pow.f64 (sin.f64 (/.f64 (-.f64 phi1 phi2) #s(literal 2 binary64))) #s(literal 2 binary64)) (*.f64 (*.f64 (*.f64 (cos.f64 phi1) (cos.f64 phi2)) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))) (sin.f64 (/.f64 (-.f64 lambda1 lambda2) #s(literal 2 binary64)))))))))

          1. Initial program 62.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

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
          4. Applied rewrites52.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} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
          5. Taylor expanded in phi2 around 0

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

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
            2. lower-fma.f64N/A

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

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\mathsf{fma}\left({\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}\right) \]
        10. Recombined 2 regimes into one program.
        11. Add Preprocessing

        Alternative 9: 63.4% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \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{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_1}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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 (* (* (* (cos phi1) (cos phi2)) t_0) t_0)))
           (*
            R
            (*
             2.0
             (atan2
              (sqrt (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) t_1))
              (sqrt
               (-
                1.0
                (+
                 (pow
                  (fma
                   (sin (/ phi2 2.0))
                   (- (cos (/ phi1 -2.0)))
                   (* (cos (/ phi2 -2.0)) (sin (/ phi1 2.0))))
                  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 = ((cos(phi1) * cos(phi2)) * t_0) * t_0;
        	return R * (2.0 * atan2(sqrt((pow(sin(((phi1 - phi2) / 2.0)), 2.0) + t_1)), sqrt((1.0 - (pow(fma(sin((phi2 / 2.0)), -cos((phi1 / -2.0)), (cos((phi2 / -2.0)) * sin((phi1 / 2.0)))), 2.0) + t_1)))));
        }
        
        function code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
        	t_1 = Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0)
        	return Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + t_1)), sqrt(Float64(1.0 - Float64((fma(sin(Float64(phi2 / 2.0)), Float64(-cos(Float64(phi1 / -2.0))), Float64(cos(Float64(phi2 / -2.0)) * sin(Float64(phi1 / 2.0)))) ^ 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[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $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] + t$95$1), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(N[Sin[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision] * (-N[Cos[N[(phi1 / -2.0), $MachinePrecision]], $MachinePrecision]) + N[(N[Cos[N[(phi2 / -2.0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(phi1 / 2.0), $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 := \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{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_1}}{\sqrt{1 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\right)\right)\right)}^{2} + t\_1\right)}}\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 64.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. Step-by-step derivation
          1. lift-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          5. sin-diffN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          6. lower--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          7. lower-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
          8. lower-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
          9. lower-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
          10. lower-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
          11. lower-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
          12. lower-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
          13. lower-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
          14. lower-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
          15. lower-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
          16. lower-/.f6465.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 - \left({\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 \color{blue}{\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. Applied rewrites65.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 - \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) \]
        5. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          2. lift-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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. fp-cancel-sub-sign-invN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) + \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\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. +-commutativeN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right) \cdot \sin \left(\frac{\phi_2}{2}\right) + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. *-commutativeN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\sin \left(\frac{\phi_2}{2}\right) \cdot \left(\mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right)\right)} + \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \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. lower-fma.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\sin \left(\frac{\phi_2}{2}\right), \mathsf{neg}\left(\cos \left(\frac{\phi_1}{2}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-neg.f6465.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), \color{blue}{-\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\frac{\phi_1}{2}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. cos-neg-revN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\color{blue}{\cos \left(\mathsf{neg}\left(\frac{\phi_1}{2}\right)\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lift-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\mathsf{neg}\left(\color{blue}{\frac{\phi_1}{2}}\right)\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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-neg-frac2N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. lower-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \color{blue}{\left(\frac{\phi_1}{\mathsf{neg}\left(2\right)}\right)}, \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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. metadata-eval65.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{\color{blue}{-2}}\right), \sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
          15. lift-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\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) \]
          16. *-commutativeN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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) \]
          17. lower-*.f6465.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 - \left({\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \color{blue}{\cos \left(\frac{\phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Applied rewrites65.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 - \left({\color{blue}{\left(\mathsf{fma}\left(\sin \left(\frac{\phi_2}{2}\right), -\cos \left(\frac{\phi_1}{-2}\right), \cos \left(\frac{\phi_2}{-2}\right) \cdot \sin \left(\frac{\phi_1}{2}\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. Add Preprocessing

        Alternative 10: 63.4% accurate, 0.8× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \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{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_1}}{\sqrt{1 - \left({\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} + 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 (* (* (* (cos phi1) (cos phi2)) t_0) t_0)))
           (*
            R
            (*
             2.0
             (atan2
              (sqrt (+ (pow (sin (/ (- phi1 phi2) 2.0)) 2.0) t_1))
              (sqrt
               (-
                1.0
                (+
                 (pow
                  (-
                   (* (sin (/ phi1 2.0)) (cos (/ phi2 2.0)))
                   (* (cos (/ phi1 2.0)) (sin (/ phi2 2.0))))
                  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 = ((cos(phi1) * cos(phi2)) * t_0) * t_0;
        	return R * (2.0 * atan2(sqrt((pow(sin(((phi1 - phi2) / 2.0)), 2.0) + t_1)), sqrt((1.0 - (pow(((sin((phi1 / 2.0)) * cos((phi2 / 2.0))) - (cos((phi1 / 2.0)) * sin((phi2 / 2.0)))), 2.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 = ((cos(phi1) * cos(phi2)) * t_0) * t_0
            code = r * (2.0d0 * atan2(sqrt(((sin(((phi1 - phi2) / 2.0d0)) ** 2.0d0) + t_1)), sqrt((1.0d0 - ((((sin((phi1 / 2.0d0)) * cos((phi2 / 2.0d0))) - (cos((phi1 / 2.0d0)) * sin((phi2 / 2.0d0)))) ** 2.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.cos(phi1) * Math.cos(phi2)) * t_0) * t_0;
        	return R * (2.0 * Math.atan2(Math.sqrt((Math.pow(Math.sin(((phi1 - phi2) / 2.0)), 2.0) + t_1)), Math.sqrt((1.0 - (Math.pow(((Math.sin((phi1 / 2.0)) * Math.cos((phi2 / 2.0))) - (Math.cos((phi1 / 2.0)) * Math.sin((phi2 / 2.0)))), 2.0) + t_1)))));
        }
        
        def code(R, lambda1, lambda2, phi1, phi2):
        	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
        	t_1 = ((math.cos(phi1) * math.cos(phi2)) * t_0) * t_0
        	return R * (2.0 * math.atan2(math.sqrt((math.pow(math.sin(((phi1 - phi2) / 2.0)), 2.0) + t_1)), math.sqrt((1.0 - (math.pow(((math.sin((phi1 / 2.0)) * math.cos((phi2 / 2.0))) - (math.cos((phi1 / 2.0)) * math.sin((phi2 / 2.0)))), 2.0) + t_1)))))
        
        function code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
        	t_1 = Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0)
        	return Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + t_1)), sqrt(Float64(1.0 - Float64((Float64(Float64(sin(Float64(phi1 / 2.0)) * cos(Float64(phi2 / 2.0))) - Float64(cos(Float64(phi1 / 2.0)) * sin(Float64(phi2 / 2.0)))) ^ 2.0) + t_1))))))
        end
        
        function tmp = code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(((lambda1 - lambda2) / 2.0));
        	t_1 = ((cos(phi1) * cos(phi2)) * t_0) * t_0;
        	tmp = R * (2.0 * atan2(sqrt(((sin(((phi1 - phi2) / 2.0)) ^ 2.0) + t_1)), sqrt((1.0 - ((((sin((phi1 / 2.0)) * cos((phi2 / 2.0))) - (cos((phi1 / 2.0)) * sin((phi2 / 2.0)))) ^ 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[(N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $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] + t$95$1), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[Power[N[(N[(N[Sin[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(phi2 / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - N[(N[Cos[N[(phi1 / 2.0), $MachinePrecision]], $MachinePrecision] * N[Sin[N[(phi2 / 2.0), $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 := \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{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_1}}{\sqrt{1 - \left({\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} + t\_1\right)}}\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 64.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. Step-by-step derivation
          1. lift-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - \phi_2}{2}\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\color{blue}{\phi_1 - \phi_2}}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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-subN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          5. sin-diffN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          6. lower--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          7. lower-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
          8. lower-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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}{\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) \]
          9. lower-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\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) \]
          10. lower-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
          11. lower-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \color{blue}{\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) \]
          12. lower-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
          13. lower-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \color{blue}{\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) \]
          14. lower-/.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \color{blue}{\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) \]
          15. lower-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \color{blue}{\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) \]
          16. lower-/.f6465.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 - \left({\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 \color{blue}{\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. Applied rewrites65.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 - \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) \]
        5. Add Preprocessing

        Alternative 11: 62.6% accurate, 1.0× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \cos \left(\frac{\phi_1 - \phi_2}{-2}\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 t\_0\right) \cdot t\_0}}{\sqrt{\mathsf{fma}\left(t\_1, t\_1, \left(-t\_0\right) \cdot \left(\left(t\_0 \cdot \cos \phi_1\right) \cdot \cos \phi_2\right)\right)}}\right) \end{array} \end{array} \]
        (FPCore (R lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0)))
                (t_1 (cos (/ (- phi1 phi2) -2.0))))
           (*
            R
            (*
             2.0
             (atan2
              (sqrt
               (+
                (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
                (* (* (* (cos phi1) (cos phi2)) t_0) t_0)))
              (sqrt (fma t_1 t_1 (* (- t_0) (* (* t_0 (cos phi1)) (cos phi2))))))))))
        double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = sin(((lambda1 - lambda2) / 2.0));
        	double t_1 = cos(((phi1 - phi2) / -2.0));
        	return R * (2.0 * atan2(sqrt((pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0))), sqrt(fma(t_1, t_1, (-t_0 * ((t_0 * cos(phi1)) * cos(phi2)))))));
        }
        
        function code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
        	t_1 = cos(Float64(Float64(phi1 - phi2) / -2.0))
        	return Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0))), sqrt(fma(t_1, t_1, Float64(Float64(-t_0) * Float64(Float64(t_0 * cos(phi1)) * cos(phi2))))))))
        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[Cos[N[(N[(phi1 - phi2), $MachinePrecision] / -2.0), $MachinePrecision]], $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[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(t$95$1 * t$95$1 + N[((-t$95$0) * N[(N[(t$95$0 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $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 := \cos \left(\frac{\phi_1 - \phi_2}{-2}\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 t\_0\right) \cdot t\_0}}{\sqrt{\mathsf{fma}\left(t\_1, t\_1, \left(-t\_0\right) \cdot \left(\left(t\_0 \cdot \cos \phi_1\right) \cdot \cos \phi_2\right)\right)}}\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 64.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. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. associate--r+N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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) \]
          4. lift-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}}\right) \]
          5. *-commutativeN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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}{\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) \]
          6. fp-cancel-sub-sign-invN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\mathsf{neg}\left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}}\right) \]
        4. Applied rewrites64.4%

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

        Alternative 12: 62.6% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0\\ t_2 := \frac{\phi_1 - \phi_2}{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin t\_2}^{2} + t\_1}}{\sqrt{1 - \left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot t\_2\right)\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 (* (* (* (cos phi1) (cos phi2)) t_0) t_0))
                (t_2 (/ (- phi1 phi2) 2.0)))
           (*
            R
            (*
             2.0
             (atan2
              (sqrt (+ (pow (sin t_2) 2.0) t_1))
              (sqrt (- 1.0 (+ (- 0.5 (* 0.5 (cos (* 2.0 t_2)))) 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 = ((cos(phi1) * cos(phi2)) * t_0) * t_0;
        	double t_2 = (phi1 - phi2) / 2.0;
        	return R * (2.0 * atan2(sqrt((pow(sin(t_2), 2.0) + t_1)), sqrt((1.0 - ((0.5 - (0.5 * cos((2.0 * t_2)))) + 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
            real(8) :: t_2
            t_0 = sin(((lambda1 - lambda2) / 2.0d0))
            t_1 = ((cos(phi1) * cos(phi2)) * t_0) * t_0
            t_2 = (phi1 - phi2) / 2.0d0
            code = r * (2.0d0 * atan2(sqrt(((sin(t_2) ** 2.0d0) + t_1)), sqrt((1.0d0 - ((0.5d0 - (0.5d0 * cos((2.0d0 * t_2)))) + 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.cos(phi1) * Math.cos(phi2)) * t_0) * t_0;
        	double t_2 = (phi1 - phi2) / 2.0;
        	return R * (2.0 * Math.atan2(Math.sqrt((Math.pow(Math.sin(t_2), 2.0) + t_1)), Math.sqrt((1.0 - ((0.5 - (0.5 * Math.cos((2.0 * t_2)))) + t_1)))));
        }
        
        def code(R, lambda1, lambda2, phi1, phi2):
        	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
        	t_1 = ((math.cos(phi1) * math.cos(phi2)) * t_0) * t_0
        	t_2 = (phi1 - phi2) / 2.0
        	return R * (2.0 * math.atan2(math.sqrt((math.pow(math.sin(t_2), 2.0) + t_1)), math.sqrt((1.0 - ((0.5 - (0.5 * math.cos((2.0 * t_2)))) + t_1)))))
        
        function code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
        	t_1 = Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0)
        	t_2 = Float64(Float64(phi1 - phi2) / 2.0)
        	return Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(t_2) ^ 2.0) + t_1)), sqrt(Float64(1.0 - Float64(Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * t_2)))) + t_1))))))
        end
        
        function tmp = code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(((lambda1 - lambda2) / 2.0));
        	t_1 = ((cos(phi1) * cos(phi2)) * t_0) * t_0;
        	t_2 = (phi1 - phi2) / 2.0;
        	tmp = R * (2.0 * atan2(sqrt(((sin(t_2) ^ 2.0) + t_1)), sqrt((1.0 - ((0.5 - (0.5 * cos((2.0 * t_2)))) + 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[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[Power[N[Sin[t$95$2], $MachinePrecision], 2.0], $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $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 := \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0\\
        t_2 := \frac{\phi_1 - \phi_2}{2}\\
        R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin t\_2}^{2} + t\_1}}{\sqrt{1 - \left(\left(0.5 - 0.5 \cdot \cos \left(2 \cdot t\_2\right)\right) + t\_1\right)}}\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 64.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. Step-by-step derivation
          1. lift-pow.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)}^{2}} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. unpow2N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          3. lift-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          4. lift-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \cdot \color{blue}{\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) \]
          5. sqr-sin-aN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \frac{\phi_1 - \phi_2}{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)}}\right) \]
          6. lower--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \frac{\phi_1 - \phi_2}{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)}}\right) \]
          7. cos-2N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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{1}{2} - \frac{1}{2} \cdot \color{blue}{\left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right) - \sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)\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)}}\right) \]
          8. cos-sumN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{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)}}\right) \]
          9. lower-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{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)}}\right) \]
          10. cos-sumN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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{1}{2} - \frac{1}{2} \cdot \color{blue}{\left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right) - \sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)\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)}}\right) \]
          11. cos-2N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot \frac{\phi_1 - \phi_2}{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)}}\right) \]
          12. lower-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot \frac{\phi_1 - \phi_2}{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)}}\right) \]
          13. lower-*.f6464.4

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot \frac{\phi_1 - \phi_2}{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)}}\right) \]
        4. Applied rewrites64.4%

          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 - 0.5 \cdot \cos \left(2 \cdot \frac{\phi_1 - \phi_2}{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)}}\right) \]
        5. Add Preprocessing

        Alternative 13: 63.0% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \frac{\phi_1 - \phi_2}{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin t\_1}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0}}{\sqrt{1 - \frac{\mathsf{fma}\left(\cos \left(\phi_1 - \phi_2\right) + \cos \left(\phi_2 + \phi_1\right), {t\_0}^{2}, 1 - \cos \left(2 \cdot t\_1\right)\right)}{2}}}\right) \end{array} \end{array} \]
        (FPCore (R lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0))) (t_1 (/ (- phi1 phi2) 2.0)))
           (*
            R
            (*
             2.0
             (atan2
              (sqrt (+ (pow (sin t_1) 2.0) (* (* (* (cos phi1) (cos phi2)) t_0) t_0)))
              (sqrt
               (-
                1.0
                (/
                 (fma
                  (+ (cos (- phi1 phi2)) (cos (+ phi2 phi1)))
                  (pow t_0 2.0)
                  (- 1.0 (cos (* 2.0 t_1))))
                 2.0))))))))
        double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = sin(((lambda1 - lambda2) / 2.0));
        	double t_1 = (phi1 - phi2) / 2.0;
        	return R * (2.0 * atan2(sqrt((pow(sin(t_1), 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0))), sqrt((1.0 - (fma((cos((phi1 - phi2)) + cos((phi2 + phi1))), pow(t_0, 2.0), (1.0 - cos((2.0 * t_1)))) / 2.0)))));
        }
        
        function code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
        	t_1 = Float64(Float64(phi1 - phi2) / 2.0)
        	return Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(t_1) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0))), sqrt(Float64(1.0 - Float64(fma(Float64(cos(Float64(phi1 - phi2)) + cos(Float64(phi2 + phi1))), (t_0 ^ 2.0), Float64(1.0 - cos(Float64(2.0 * t_1)))) / 2.0))))))
        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[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[Power[N[Sin[t$95$1], $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]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(N[(N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] + N[Cos[N[(phi2 + phi1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision] + N[(1.0 - N[Cos[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $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 := \frac{\phi_1 - \phi_2}{2}\\
        R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin t\_1}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0}}{\sqrt{1 - \frac{\mathsf{fma}\left(\cos \left(\phi_1 - \phi_2\right) + \cos \left(\phi_2 + \phi_1\right), {t\_0}^{2}, 1 - \cos \left(2 \cdot t\_1\right)\right)}{2}}}\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 64.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. Step-by-step derivation
          1. lift-+.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
          3. lift-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\cos \phi_1 \cdot \cos \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) \]
          4. lift-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\left(\cos \phi_1 \cdot \cos \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) \]
          5. associate-*l*N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          6. lift-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
          7. lift-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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 \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) \]
          8. lift-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \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 \phi_1 \cdot \color{blue}{\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) \]
          9. cos-multN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\phi_1 + \phi_2\right) + \cos \left(\phi_1 - \phi_2\right)}{2}} \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) \]
          10. associate-*l/N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\left(\cos \left(\phi_1 + \phi_2\right) + \cos \left(\phi_1 - \phi_2\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}{2}} + {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right) \]
          11. lift-pow.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\left(\cos \left(\phi_1 + \phi_2\right) + \cos \left(\phi_1 - \phi_2\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}{2} + \color{blue}{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}\right)}}\right) \]
          12. unpow2N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\left(\cos \left(\phi_1 + \phi_2\right) + \cos \left(\phi_1 - \phi_2\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}{2} + \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}}\right) \]
          13. lift-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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{\left(\cos \left(\phi_1 + \phi_2\right) + \cos \left(\phi_1 - \phi_2\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}{2} + \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)} \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)\right)}}\right) \]
        4. Applied rewrites65.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}{\frac{\mathsf{fma}\left(\cos \left(\phi_1 - \phi_2\right) + \cos \left(\phi_2 + \phi_1\right), {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2}, \cos \left(\frac{\left(\phi_1 - \phi_2\right) - \left(\phi_1 - \phi_2\right)}{2}\right) - \cos \left(2 \cdot \frac{\phi_1 - \phi_2}{2}\right)\right)}{2}}}}\right) \]
        5. Final simplification65.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 - \frac{\mathsf{fma}\left(\cos \left(\phi_1 - \phi_2\right) + \cos \left(\phi_2 + \phi_1\right), {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2}, 1 - \cos \left(2 \cdot \frac{\phi_1 - \phi_2}{2}\right)\right)}{2}}}\right) \]
        6. Add Preprocessing

        Alternative 14: 62.6% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \frac{\phi_1 - \phi_2}{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin t\_1}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0}}{\sqrt{\left(1 - {t\_0}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot t\_1\right)\right)}}\right) \end{array} \end{array} \]
        (FPCore (R lambda1 lambda2 phi1 phi2)
         :precision binary64
         (let* ((t_0 (sin (/ (- lambda1 lambda2) 2.0))) (t_1 (/ (- phi1 phi2) 2.0)))
           (*
            R
            (*
             2.0
             (atan2
              (sqrt (+ (pow (sin t_1) 2.0) (* (* (* (cos phi1) (cos phi2)) t_0) t_0)))
              (sqrt
               (-
                (- 1.0 (* (pow t_0 2.0) (* (cos phi2) (cos phi1))))
                (- 0.5 (* 0.5 (cos (* 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 = (phi1 - phi2) / 2.0;
        	return R * (2.0 * atan2(sqrt((pow(sin(t_1), 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0))), sqrt(((1.0 - (pow(t_0, 2.0) * (cos(phi2) * cos(phi1)))) - (0.5 - (0.5 * cos((2.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 = (phi1 - phi2) / 2.0d0
            code = r * (2.0d0 * atan2(sqrt(((sin(t_1) ** 2.0d0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0))), sqrt(((1.0d0 - ((t_0 ** 2.0d0) * (cos(phi2) * cos(phi1)))) - (0.5d0 - (0.5d0 * cos((2.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 = (phi1 - phi2) / 2.0;
        	return R * (2.0 * Math.atan2(Math.sqrt((Math.pow(Math.sin(t_1), 2.0) + (((Math.cos(phi1) * Math.cos(phi2)) * t_0) * t_0))), Math.sqrt(((1.0 - (Math.pow(t_0, 2.0) * (Math.cos(phi2) * Math.cos(phi1)))) - (0.5 - (0.5 * Math.cos((2.0 * t_1))))))));
        }
        
        def code(R, lambda1, lambda2, phi1, phi2):
        	t_0 = math.sin(((lambda1 - lambda2) / 2.0))
        	t_1 = (phi1 - phi2) / 2.0
        	return R * (2.0 * math.atan2(math.sqrt((math.pow(math.sin(t_1), 2.0) + (((math.cos(phi1) * math.cos(phi2)) * t_0) * t_0))), math.sqrt(((1.0 - (math.pow(t_0, 2.0) * (math.cos(phi2) * math.cos(phi1)))) - (0.5 - (0.5 * math.cos((2.0 * t_1))))))))
        
        function code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
        	t_1 = Float64(Float64(phi1 - phi2) / 2.0)
        	return Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(t_1) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_0) * t_0))), sqrt(Float64(Float64(1.0 - Float64((t_0 ^ 2.0) * Float64(cos(phi2) * cos(phi1)))) - Float64(0.5 - Float64(0.5 * cos(Float64(2.0 * t_1)))))))))
        end
        
        function tmp = code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(((lambda1 - lambda2) / 2.0));
        	t_1 = (phi1 - phi2) / 2.0;
        	tmp = R * (2.0 * atan2(sqrt(((sin(t_1) ^ 2.0) + (((cos(phi1) * cos(phi2)) * t_0) * t_0))), sqrt(((1.0 - ((t_0 ^ 2.0) * (cos(phi2) * cos(phi1)))) - (0.5 - (0.5 * cos((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[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[Power[N[Sin[t$95$1], $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]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[(N[Power[t$95$0, 2.0], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(0.5 - N[(0.5 * N[Cos[N[(2.0 * t$95$1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $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 := \frac{\phi_1 - \phi_2}{2}\\
        R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin t\_1}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0\right) \cdot t\_0}}{\sqrt{\left(1 - {t\_0}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(0.5 - 0.5 \cdot \cos \left(2 \cdot t\_1\right)\right)}}\right)
        \end{array}
        \end{array}
        
        Derivation
        1. Initial program 64.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. Step-by-step derivation
          1. lift--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
          4. associate--r+N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
          5. lower--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
        4. Applied rewrites64.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(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
        5. Step-by-step derivation
          1. lift-pow.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \color{blue}{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
          2. unpow2N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}}}\right) \]
          3. lift-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)} \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}}\right) \]
          4. lift-sin.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}}}\right) \]
          5. sqr-sin-aN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \frac{\phi_1 - \phi_2}{2}\right)\right)}}}\right) \]
          6. lower--.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \color{blue}{\left(\frac{1}{2} - \frac{1}{2} \cdot \cos \left(2 \cdot \frac{\phi_1 - \phi_2}{2}\right)\right)}}}\right) \]
          7. cos-2N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right) - \sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)\right)}\right)}}\right) \]
          8. cos-sumN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}\right)}}\right) \]
          9. lower-*.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(\frac{1}{2} - \color{blue}{\frac{1}{2} \cdot \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}\right)}}\right) \]
          10. cos-sumN/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right) - \sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)\right)}\right)}}\right) \]
          11. cos-2N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot \frac{\phi_1 - \phi_2}{2}\right)}\right)}}\right) \]
          12. lower-cos.f64N/A

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(\frac{1}{2} - \frac{1}{2} \cdot \color{blue}{\cos \left(2 \cdot \frac{\phi_1 - \phi_2}{2}\right)}\right)}}\right) \]
          13. lower-*.f6464.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 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \left(0.5 - 0.5 \cdot \cos \color{blue}{\left(2 \cdot \frac{\phi_1 - \phi_2}{2}\right)}\right)}}\right) \]
        6. Applied rewrites64.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 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - \color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \frac{\phi_1 - \phi_2}{2}\right)\right)}}}\right) \]
        7. Add Preprocessing

        Alternative 15: 62.9% accurate, 1.1× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := \sqrt{\mathsf{fma}\left(t\_0, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}\\ \mathbf{if}\;\phi_1 \leq -2.05 \cdot 10^{-23}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_2}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - t\_0 \cdot \cos \phi_1}}\right)\\ \mathbf{elif}\;\phi_1 \leq 9 \cdot 10^{-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 t\_1\right) \cdot t\_1}}{\sqrt{1 - \mathsf{fma}\left(t\_0, \cos \phi_2, {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_2}{\sqrt{\mathsf{fma}\left(-{\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}, \cos \phi_1, {\cos \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 (* (- lambda2 lambda1) -0.5)) 2.0))
                (t_1 (sin (/ (- lambda1 lambda2) 2.0)))
                (t_2 (sqrt (fma t_0 (cos phi1) (pow (sin (* 0.5 phi1)) 2.0)))))
           (if (<= phi1 -2.05e-23)
             (*
              R
              (*
               2.0
               (atan2
                t_2
                (sqrt (- (pow (cos (* -0.5 phi1)) 2.0) (* t_0 (cos phi1)))))))
             (if (<= phi1 9e-5)
               (*
                R
                (*
                 2.0
                 (atan2
                  (sqrt
                   (+
                    (pow (sin (/ (- phi1 phi2) 2.0)) 2.0)
                    (* (* (* (cos phi1) (cos phi2)) t_1) t_1)))
                  (sqrt (- 1.0 (fma t_0 (cos phi2) (pow (sin (* -0.5 phi2)) 2.0)))))))
               (*
                R
                (*
                 2.0
                 (atan2
                  t_2
                  (sqrt
                   (fma
                    (- (pow (sin (* -0.5 (- lambda2 lambda1))) 2.0))
                    (cos phi1)
                    (pow (cos (* 0.5 phi1)) 2.0))))))))))
        double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
        	double t_0 = pow(sin(((lambda2 - lambda1) * -0.5)), 2.0);
        	double t_1 = sin(((lambda1 - lambda2) / 2.0));
        	double t_2 = sqrt(fma(t_0, cos(phi1), pow(sin((0.5 * phi1)), 2.0)));
        	double tmp;
        	if (phi1 <= -2.05e-23) {
        		tmp = R * (2.0 * atan2(t_2, sqrt((pow(cos((-0.5 * phi1)), 2.0) - (t_0 * cos(phi1))))));
        	} else if (phi1 <= 9e-5) {
        		tmp = R * (2.0 * atan2(sqrt((pow(sin(((phi1 - phi2) / 2.0)), 2.0) + (((cos(phi1) * cos(phi2)) * t_1) * t_1))), sqrt((1.0 - fma(t_0, cos(phi2), pow(sin((-0.5 * phi2)), 2.0))))));
        	} else {
        		tmp = R * (2.0 * atan2(t_2, sqrt(fma(-pow(sin((-0.5 * (lambda2 - lambda1))), 2.0), cos(phi1), pow(cos((0.5 * phi1)), 2.0)))));
        	}
        	return tmp;
        }
        
        function code(R, lambda1, lambda2, phi1, phi2)
        	t_0 = sin(Float64(Float64(lambda2 - lambda1) * -0.5)) ^ 2.0
        	t_1 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
        	t_2 = sqrt(fma(t_0, cos(phi1), (sin(Float64(0.5 * phi1)) ^ 2.0)))
        	tmp = 0.0
        	if (phi1 <= -2.05e-23)
        		tmp = Float64(R * Float64(2.0 * atan(t_2, sqrt(Float64((cos(Float64(-0.5 * phi1)) ^ 2.0) - Float64(t_0 * cos(phi1)))))));
        	elseif (phi1 <= 9e-5)
        		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * t_1) * t_1))), sqrt(Float64(1.0 - fma(t_0, cos(phi2), (sin(Float64(-0.5 * phi2)) ^ 2.0)))))));
        	else
        		tmp = Float64(R * Float64(2.0 * atan(t_2, sqrt(fma(Float64(-(sin(Float64(-0.5 * Float64(lambda2 - lambda1))) ^ 2.0)), cos(phi1), (cos(Float64(0.5 * phi1)) ^ 2.0))))));
        	end
        	return tmp
        end
        
        code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(N[(lambda2 - lambda1), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(t$95$0 * N[Cos[phi1], $MachinePrecision] + N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -2.05e-23], N[(R * N[(2.0 * N[ArcTan[t$95$2 / N[Sqrt[N[(N[Power[N[Cos[N[(-0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - N[(t$95$0 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 9e-5], 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[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[(t$95$0 * N[Cos[phi2], $MachinePrecision] + N[Power[N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$2 / N[Sqrt[N[((-N[Power[N[Sin[N[(-0.5 * N[(lambda2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]) * N[Cos[phi1], $MachinePrecision] + N[Power[N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        t_0 := {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}\\
        t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
        t_2 := \sqrt{\mathsf{fma}\left(t\_0, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}\\
        \mathbf{if}\;\phi_1 \leq -2.05 \cdot 10^{-23}:\\
        \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_2}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - t\_0 \cdot \cos \phi_1}}\right)\\
        
        \mathbf{elif}\;\phi_1 \leq 9 \cdot 10^{-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 t\_1\right) \cdot t\_1}}{\sqrt{1 - \mathsf{fma}\left(t\_0, \cos \phi_2, {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}\right)\\
        
        \mathbf{else}:\\
        \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_2}{\sqrt{\mathsf{fma}\left(-{\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}, \cos \phi_1, {\cos \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.05000000000000015e-23

          1. Initial program 45.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
          4. Applied rewrites47.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} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
          5. Taylor expanded in phi2 around 0

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

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
            2. lower-fma.f64N/A

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

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

          if -2.05000000000000015e-23 < phi1 < 9.00000000000000057e-5

          1. Initial program 77.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 phi1 around 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(\cos \phi_2 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}}\right) \]
          4. Applied rewrites77.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}{\mathsf{fma}\left({\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}, \cos \phi_2, {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]

          if 9.00000000000000057e-5 < phi1

          1. Initial program 57.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
          4. Applied rewrites59.4%

            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
          5. Taylor expanded in phi2 around 0

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

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
            2. lower-fma.f64N/A

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

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

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

          Alternative 16: 63.3% accurate, 1.1× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}\\ t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_2 := \sqrt{\mathsf{fma}\left(t\_0, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}\\ \mathbf{if}\;\phi_1 \leq -0.055:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_2}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - t\_0 \cdot \cos \phi_1}}\right)\\ \mathbf{elif}\;\phi_1 \leq 0.00046:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 + t\_0 \cdot \cos \phi_2}}{\sqrt{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_1}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_2}{\sqrt{\mathsf{fma}\left(-{\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}, \cos \phi_1, {\cos \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 (* (- lambda2 lambda1) -0.5)) 2.0))
                  (t_1 (pow (sin (/ (- phi1 phi2) 2.0)) 2.0))
                  (t_2 (sqrt (fma t_0 (cos phi1) (pow (sin (* 0.5 phi1)) 2.0)))))
             (if (<= phi1 -0.055)
               (*
                R
                (*
                 2.0
                 (atan2
                  t_2
                  (sqrt (- (pow (cos (* -0.5 phi1)) 2.0) (* t_0 (cos phi1)))))))
               (if (<= phi1 0.00046)
                 (*
                  R
                  (*
                   2.0
                   (atan2
                    (sqrt (+ t_1 (* t_0 (cos phi2))))
                    (sqrt
                     (-
                      (-
                       1.0
                       (*
                        (pow (sin (/ (- lambda1 lambda2) 2.0)) 2.0)
                        (* (cos phi2) (cos phi1))))
                      t_1)))))
                 (*
                  R
                  (*
                   2.0
                   (atan2
                    t_2
                    (sqrt
                     (fma
                      (- (pow (sin (* -0.5 (- lambda2 lambda1))) 2.0))
                      (cos phi1)
                      (pow (cos (* 0.5 phi1)) 2.0))))))))))
          double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
          	double t_0 = pow(sin(((lambda2 - lambda1) * -0.5)), 2.0);
          	double t_1 = pow(sin(((phi1 - phi2) / 2.0)), 2.0);
          	double t_2 = sqrt(fma(t_0, cos(phi1), pow(sin((0.5 * phi1)), 2.0)));
          	double tmp;
          	if (phi1 <= -0.055) {
          		tmp = R * (2.0 * atan2(t_2, sqrt((pow(cos((-0.5 * phi1)), 2.0) - (t_0 * cos(phi1))))));
          	} else if (phi1 <= 0.00046) {
          		tmp = R * (2.0 * atan2(sqrt((t_1 + (t_0 * cos(phi2)))), sqrt(((1.0 - (pow(sin(((lambda1 - lambda2) / 2.0)), 2.0) * (cos(phi2) * cos(phi1)))) - t_1))));
          	} else {
          		tmp = R * (2.0 * atan2(t_2, sqrt(fma(-pow(sin((-0.5 * (lambda2 - lambda1))), 2.0), cos(phi1), pow(cos((0.5 * phi1)), 2.0)))));
          	}
          	return tmp;
          }
          
          function code(R, lambda1, lambda2, phi1, phi2)
          	t_0 = sin(Float64(Float64(lambda2 - lambda1) * -0.5)) ^ 2.0
          	t_1 = sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0
          	t_2 = sqrt(fma(t_0, cos(phi1), (sin(Float64(0.5 * phi1)) ^ 2.0)))
          	tmp = 0.0
          	if (phi1 <= -0.055)
          		tmp = Float64(R * Float64(2.0 * atan(t_2, sqrt(Float64((cos(Float64(-0.5 * phi1)) ^ 2.0) - Float64(t_0 * cos(phi1)))))));
          	elseif (phi1 <= 0.00046)
          		tmp = Float64(R * Float64(2.0 * atan(sqrt(Float64(t_1 + Float64(t_0 * cos(phi2)))), sqrt(Float64(Float64(1.0 - Float64((sin(Float64(Float64(lambda1 - lambda2) / 2.0)) ^ 2.0) * Float64(cos(phi2) * cos(phi1)))) - t_1)))));
          	else
          		tmp = Float64(R * Float64(2.0 * atan(t_2, sqrt(fma(Float64(-(sin(Float64(-0.5 * Float64(lambda2 - lambda1))) ^ 2.0)), cos(phi1), (cos(Float64(0.5 * phi1)) ^ 2.0))))));
          	end
          	return tmp
          end
          
          code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(N[(lambda2 - lambda1), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$2 = N[Sqrt[N[(t$95$0 * N[Cos[phi1], $MachinePrecision] + N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -0.055], N[(R * N[(2.0 * N[ArcTan[t$95$2 / N[Sqrt[N[(N[Power[N[Cos[N[(-0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] - N[(t$95$0 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 0.00046], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$1 + N[(t$95$0 * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[(N[Power[N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - t$95$1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$2 / N[Sqrt[N[((-N[Power[N[Sin[N[(-0.5 * N[(lambda2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]) * N[Cos[phi1], $MachinePrecision] + N[Power[N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          t_0 := {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}\\
          t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
          t_2 := \sqrt{\mathsf{fma}\left(t\_0, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}\\
          \mathbf{if}\;\phi_1 \leq -0.055:\\
          \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_2}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - t\_0 \cdot \cos \phi_1}}\right)\\
          
          \mathbf{elif}\;\phi_1 \leq 0.00046:\\
          \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 + t\_0 \cdot \cos \phi_2}}{\sqrt{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - t\_1}}\right)\\
          
          \mathbf{else}:\\
          \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_2}{\sqrt{\mathsf{fma}\left(-{\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}, \cos \phi_1, {\cos \left(0.5 \cdot \phi_1\right)}^{2}\right)}}\right)\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if phi1 < -0.0550000000000000003

            1. Initial program 44.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
            4. Applied rewrites47.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_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
            5. Taylor expanded in phi2 around 0

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

                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
              2. lower-fma.f64N/A

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

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

            if -0.0550000000000000003 < phi1 < 4.6000000000000001e-4

            1. Initial program 76.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. Step-by-step derivation
              1. lift--.f64N/A

                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
              4. associate--r+N/A

                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
              5. lower--.f64N/A

                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
            4. Applied rewrites76.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(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
            5. Taylor expanded in phi1 around 0

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

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

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

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

            if 4.6000000000000001e-4 < phi1

            1. Initial program 57.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
            4. Applied rewrites59.4%

              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
            5. Taylor expanded in phi2 around 0

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

                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
              2. lower-fma.f64N/A

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

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

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

            Alternative 17: 61.3% accurate, 1.1× speedup?

            \[\begin{array}{l} \\ \begin{array}{l} t_0 := {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}\\ t_1 := \sqrt{\mathsf{fma}\left(t\_0, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}\\ \mathbf{if}\;\phi_1 \leq -1.35 \cdot 10^{-23}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - t\_0 \cdot \cos \phi_1}}\right)\\ \mathbf{elif}\;\phi_1 \leq 2.65 \cdot 10^{-45}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_0, \cos \phi_2, {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}{\sqrt{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{\mathsf{fma}\left(-{\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}, \cos \phi_1, {\cos \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 (* (- lambda2 lambda1) -0.5)) 2.0))
                    (t_1 (sqrt (fma t_0 (cos phi1) (pow (sin (* 0.5 phi1)) 2.0)))))
               (if (<= phi1 -1.35e-23)
                 (*
                  R
                  (*
                   2.0
                   (atan2
                    t_1
                    (sqrt (- (pow (cos (* -0.5 phi1)) 2.0) (* t_0 (cos phi1)))))))
                 (if (<= phi1 2.65e-45)
                   (*
                    R
                    (*
                     2.0
                     (atan2
                      (sqrt (fma t_0 (cos phi2) (pow (sin (* -0.5 phi2)) 2.0)))
                      (sqrt
                       (-
                        (-
                         1.0
                         (*
                          (pow (sin (/ (- lambda1 lambda2) 2.0)) 2.0)
                          (* (cos phi2) (cos phi1))))
                        (pow (sin (/ (- phi1 phi2) 2.0)) 2.0))))))
                   (*
                    R
                    (*
                     2.0
                     (atan2
                      t_1
                      (sqrt
                       (fma
                        (- (pow (sin (* -0.5 (- lambda2 lambda1))) 2.0))
                        (cos phi1)
                        (pow (cos (* 0.5 phi1)) 2.0))))))))))
            double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
            	double t_0 = pow(sin(((lambda2 - lambda1) * -0.5)), 2.0);
            	double t_1 = sqrt(fma(t_0, cos(phi1), pow(sin((0.5 * phi1)), 2.0)));
            	double tmp;
            	if (phi1 <= -1.35e-23) {
            		tmp = R * (2.0 * atan2(t_1, sqrt((pow(cos((-0.5 * phi1)), 2.0) - (t_0 * cos(phi1))))));
            	} else if (phi1 <= 2.65e-45) {
            		tmp = R * (2.0 * atan2(sqrt(fma(t_0, cos(phi2), pow(sin((-0.5 * phi2)), 2.0))), sqrt(((1.0 - (pow(sin(((lambda1 - lambda2) / 2.0)), 2.0) * (cos(phi2) * cos(phi1)))) - pow(sin(((phi1 - phi2) / 2.0)), 2.0)))));
            	} else {
            		tmp = R * (2.0 * atan2(t_1, sqrt(fma(-pow(sin((-0.5 * (lambda2 - lambda1))), 2.0), cos(phi1), pow(cos((0.5 * phi1)), 2.0)))));
            	}
            	return tmp;
            }
            
            function code(R, lambda1, lambda2, phi1, phi2)
            	t_0 = sin(Float64(Float64(lambda2 - lambda1) * -0.5)) ^ 2.0
            	t_1 = sqrt(fma(t_0, cos(phi1), (sin(Float64(0.5 * phi1)) ^ 2.0)))
            	tmp = 0.0
            	if (phi1 <= -1.35e-23)
            		tmp = Float64(R * Float64(2.0 * atan(t_1, sqrt(Float64((cos(Float64(-0.5 * phi1)) ^ 2.0) - Float64(t_0 * cos(phi1)))))));
            	elseif (phi1 <= 2.65e-45)
            		tmp = Float64(R * Float64(2.0 * atan(sqrt(fma(t_0, cos(phi2), (sin(Float64(-0.5 * phi2)) ^ 2.0))), sqrt(Float64(Float64(1.0 - Float64((sin(Float64(Float64(lambda1 - lambda2) / 2.0)) ^ 2.0) * Float64(cos(phi2) * cos(phi1)))) - (sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0))))));
            	else
            		tmp = Float64(R * Float64(2.0 * atan(t_1, sqrt(fma(Float64(-(sin(Float64(-0.5 * Float64(lambda2 - lambda1))) ^ 2.0)), cos(phi1), (cos(Float64(0.5 * phi1)) ^ 2.0))))));
            	end
            	return tmp
            end
            
            code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Power[N[Sin[N[(N[(lambda2 - lambda1), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]}, Block[{t$95$1 = N[Sqrt[N[(t$95$0 * N[Cos[phi1], $MachinePrecision] + N[Power[N[Sin[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[phi1, -1.35e-23], 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[(t$95$0 * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[phi1, 2.65e-45], N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$0 * N[Cos[phi2], $MachinePrecision] + N[Power[N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(N[(1.0 - N[(N[Power[N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Cos[phi2], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Power[N[Sin[N[(N[(phi1 - phi2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(R * N[(2.0 * N[ArcTan[t$95$1 / N[Sqrt[N[((-N[Power[N[Sin[N[(-0.5 * N[(lambda2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]) * N[Cos[phi1], $MachinePrecision] + N[Power[N[Cos[N[(0.5 * phi1), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
            
            \begin{array}{l}
            
            \\
            \begin{array}{l}
            t_0 := {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}\\
            t_1 := \sqrt{\mathsf{fma}\left(t\_0, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}\\
            \mathbf{if}\;\phi_1 \leq -1.35 \cdot 10^{-23}:\\
            \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - t\_0 \cdot \cos \phi_1}}\right)\\
            
            \mathbf{elif}\;\phi_1 \leq 2.65 \cdot 10^{-45}:\\
            \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t\_0, \cos \phi_2, {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}{\sqrt{\left(1 - {\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}\right)\\
            
            \mathbf{else}:\\
            \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t\_1}{\sqrt{\mathsf{fma}\left(-{\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}, \cos \phi_1, {\cos \left(0.5 \cdot \phi_1\right)}^{2}\right)}}\right)\\
            
            
            \end{array}
            \end{array}
            
            Derivation
            1. Split input into 3 regimes
            2. if phi1 < -1.34999999999999992e-23

              1. Initial program 45.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
              4. Applied rewrites47.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} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
              5. Taylor expanded in phi2 around 0

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

                  \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                2. lower-fma.f64N/A

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

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

              if -1.34999999999999992e-23 < phi1 < 2.6499999999999999e-45

              1. Initial program 77.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. Step-by-step derivation
                1. lift--.f64N/A

                  \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. lift-+.f64N/A

                  \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. +-commutativeN/A

                  \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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) \]
                4. associate--r+N/A

                  \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
                5. lower--.f64N/A

                  \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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 - \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
              4. Applied rewrites77.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(\frac{\lambda_1 - \lambda_2}{2}\right)}^{2} \cdot \left(\cos \phi_2 \cdot \cos \phi_1\right)\right) - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}}}}\right) \]
              5. Taylor expanded in phi1 around 0

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

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

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

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

              if 2.6499999999999999e-45 < phi1

              1. Initial program 59.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
              4. Applied rewrites59.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 \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
              5. Taylor expanded in phi2 around 0

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

                  \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                2. lower-fma.f64N/A

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

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

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

              Alternative 18: 58.5% accurate, 1.1× speedup?

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

                1. Initial program 42.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 lambda1 around 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(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}\right) + {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}}\right) \]
                4. Step-by-step derivation
                  1. associate-*r*N/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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 {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}} + {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}\right) \]
                  2. lower-fma.f64N/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}}\right) \]
                  3. *-commutativeN/A

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

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

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

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \color{blue}{\cos \phi_1}, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}\right) \]
                  7. lower-pow.f64N/A

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

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

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \color{blue}{\left(\frac{-1}{2} \cdot \lambda_2\right)}}^{2}, {\sin \left(\frac{1}{2} \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}\right) \]
                5. Applied rewrites33.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}{\mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(-0.5 \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot -0.5\right)}^{2}\right)}}}\right) \]
                6. Taylor expanded in phi1 around 0

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

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

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

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

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \lambda_2\right)\right)}^{2}, \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  5. fp-cancel-sign-sub-invN/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\frac{1}{2} \cdot \color{blue}{\left(\lambda_1 + -1 \cdot \lambda_2\right)}\right)}^{2}, \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  6. lower-pow.f64N/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 + -1 \cdot \lambda_2\right)\right)}^{2}}, \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  7. fp-cancel-sign-sub-invN/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\frac{1}{2} \cdot \color{blue}{\left(\lambda_1 - \left(\mathsf{neg}\left(-1\right)\right) \cdot \lambda_2\right)}\right)}^{2}, \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  8. metadata-evalN/A

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

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \color{blue}{\lambda_2}\right)\right)}^{2}, \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  10. lower-sin.f64N/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\color{blue}{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}}^{2}, \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  11. lower-*.f64N/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \color{blue}{\left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}}^{2}, \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  12. lower--.f64N/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\frac{1}{2} \cdot \color{blue}{\left(\lambda_1 - \lambda_2\right)}\right)}^{2}, \cos \phi_2, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  13. lower-cos.f64N/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, \color{blue}{\cos \phi_2}, {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  14. lower-pow.f64N/A

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, \cos \phi_2, \color{blue}{{\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}\right)}}{\sqrt{1 - \mathsf{fma}\left(\cos \phi_2 \cdot \cos \phi_1, {\sin \left(\frac{-1}{2} \cdot \lambda_2\right)}^{2}, {\sin \left(\left(\phi_2 - \phi_1\right) \cdot \frac{-1}{2}\right)}^{2}\right)}}\right) \]
                  15. lower-sin.f64N/A

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

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

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

                if -0.0074999999999999997 < phi2 < 0.00419999999999999974

                1. Initial program 81.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                4. Applied rewrites81.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                5. Taylor expanded in phi2 around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

              Alternative 19: 48.7% accurate, 1.2× speedup?

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

                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
              4. Applied rewrites55.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
              5. Taylor expanded in phi2 around 0

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

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

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

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

              Alternative 20: 46.5% accurate, 1.2× speedup?

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

                1. Initial program 49.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                4. Applied rewrites42.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}{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                5. Taylor expanded in phi2 around 0

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

                    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                  2. lower-fma.f64N/A

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

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

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

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

                  if -6.5e11 < lambda1 < 3.2000000000000002

                  1. Initial program 80.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. Add Preprocessing
                  3. Taylor expanded in phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                  4. Applied rewrites68.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} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                  5. Taylor expanded in phi2 around 0

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

                      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                    2. lower-fma.f64N/A

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

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

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

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

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

                  Alternative 21: 43.1% accurate, 1.2× speedup?

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

                    1. Initial program 53.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                    4. Applied rewrites54.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_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                    5. Taylor expanded in phi2 around 0

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

                        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                      2. lower-fma.f64N/A

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

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

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

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

                      if -2.89999999999999991e-9 < phi1 < 2.6499999999999999e-45

                      1. Initial program 78.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                      4. Applied rewrites56.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} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                      5. Taylor expanded in phi2 around 0

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

                          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                        2. lower-fma.f64N/A

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

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

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

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

                          \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sqrt{\cos \phi_2 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                        3. Step-by-step derivation
                          1. lower-sqrt.f64N/A

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

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

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

                            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \lambda_2\right)\right)}^{2} \cdot \cos \phi_2 + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                          5. fp-cancel-sign-sub-invN/A

                            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{1}{2} \cdot \color{blue}{\left(\lambda_1 + -1 \cdot \lambda_2\right)}\right)}^{2} \cdot \cos \phi_2 + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                          6. lower-fma.f64N/A

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

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

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

                      Alternative 22: 33.5% accurate, 1.7× speedup?

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

                        1. Initial program 66.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                        4. Applied rewrites53.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_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                        5. Taylor expanded in phi2 around 0

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

                            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                          2. lower-fma.f64N/A

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

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

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

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

                            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sqrt{\cos \phi_2 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                          3. Step-by-step derivation
                            1. lower-sqrt.f64N/A

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

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

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

                              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \lambda_2\right)\right)}^{2} \cdot \cos \phi_2 + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                            5. fp-cancel-sign-sub-invN/A

                              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{1}{2} \cdot \color{blue}{\left(\lambda_1 + -1 \cdot \lambda_2\right)}\right)}^{2} \cdot \cos \phi_2 + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                            6. lower-fma.f64N/A

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

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

                          if 1.0199999999999999e-45 < phi1

                          1. Initial program 59.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 phi2 around 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}{1 - \left(\cos \phi_1 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                          4. Applied rewrites59.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 \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                          5. Taylor expanded in phi2 around 0

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

                              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                            2. lower-fma.f64N/A

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

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

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

                              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}, \cos \phi_1, {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}{\sqrt{1 - \color{blue}{{\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}}}}\right) \]
                          10. Recombined 2 regimes into one program.
                          11. Add Preprocessing

                          Alternative 23: 32.7% accurate, 1.7× speedup?

                          \[\begin{array}{l} \\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, \cos \phi_2, {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}}}\right) \end{array} \]
                          (FPCore (R lambda1 lambda2 phi1 phi2)
                           :precision binary64
                           (*
                            R
                            (*
                             2.0
                             (atan2
                              (sqrt
                               (fma
                                (pow (sin (* 0.5 (- lambda1 lambda2))) 2.0)
                                (cos phi2)
                                (pow (sin (* -0.5 phi2)) 2.0)))
                              (sqrt (- 1.0 (pow (sin (* (- lambda2 lambda1) -0.5)) 2.0)))))))
                          double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
                          	return R * (2.0 * atan2(sqrt(fma(pow(sin((0.5 * (lambda1 - lambda2))), 2.0), cos(phi2), pow(sin((-0.5 * phi2)), 2.0))), sqrt((1.0 - pow(sin(((lambda2 - lambda1) * -0.5)), 2.0)))));
                          }
                          
                          function code(R, lambda1, lambda2, phi1, phi2)
                          	return Float64(R * Float64(2.0 * atan(sqrt(fma((sin(Float64(0.5 * Float64(lambda1 - lambda2))) ^ 2.0), cos(phi2), (sin(Float64(-0.5 * phi2)) ^ 2.0))), sqrt(Float64(1.0 - (sin(Float64(Float64(lambda2 - lambda1) * -0.5)) ^ 2.0))))))
                          end
                          
                          code[R_, lambda1_, lambda2_, phi1_, phi2_] := N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(N[Power[N[Sin[N[(0.5 * N[(lambda1 - lambda2), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] * N[Cos[phi2], $MachinePrecision] + N[Power[N[Sin[N[(-0.5 * phi2), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - N[Power[N[Sin[N[(N[(lambda2 - lambda1), $MachinePrecision] * -0.5), $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
                          
                          \begin{array}{l}
                          
                          \\
                          R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left({\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}, \cos \phi_2, {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2}}}\right)
                          \end{array}
                          
                          Derivation
                          1. Initial program 64.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

                            \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                          4. Applied rewrites55.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                          5. Taylor expanded in phi2 around 0

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

                              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}}}{\sqrt{{\cos \left(\frac{-1}{2} \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2} \cdot \cos \phi_1}}\right) \]
                            2. lower-fma.f64N/A

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

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

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

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

                              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\color{blue}{\sqrt{\cos \phi_2 \cdot {\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                            3. Step-by-step derivation
                              1. lower-sqrt.f64N/A

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

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

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

                                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{1}{2} \cdot \left(\lambda_1 - \color{blue}{\left(\mathsf{neg}\left(-1\right)\right)} \cdot \lambda_2\right)\right)}^{2} \cdot \cos \phi_2 + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                              5. fp-cancel-sign-sub-invN/A

                                \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{1}{2} \cdot \color{blue}{\left(\lambda_1 + -1 \cdot \lambda_2\right)}\right)}^{2} \cdot \cos \phi_2 + {\sin \left(\frac{-1}{2} \cdot \phi_2\right)}^{2}}}{\sqrt{1 - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot \frac{-1}{2}\right)}^{2}}}\right) \]
                              6. lower-fma.f64N/A

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

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

                            Alternative 24: 29.7% accurate, 1.7× speedup?

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

                              \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_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(\frac{1}{2} \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(\frac{1}{2} \cdot \phi_1\right)}^{2}\right)}}}\right) \]
                            4. Applied rewrites55.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(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_1\right)}^{2} - {\sin \left(\left(\lambda_2 - \lambda_1\right) \cdot -0.5\right)}^{2} \cdot \cos \phi_1}}}\right) \]
                            5. Taylor expanded in phi2 around 0

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

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

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

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

                              Reproduce

                              ?
                              herbie shell --seed 2024337 
                              (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))))))))))