Distance on a great circle

Percentage Accurate: 62.8% → 62.7%
Time: 1.9min
Alternatives: 13
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 13 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.8% 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: 62.7% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;\phi_2 \leq 20.5:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_3}{\sqrt{{\cos \left(\phi_1 \cdot 0.5\right)}^{2} - t_0 \cdot \frac{1 - \cos \left(\lambda_1 - \lambda_2\right)}{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_3}{t_4}\right)\\


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

    1. Initial program 51.1%

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. associate--r+52.0%

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

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

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

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

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

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

    if -7.8e11 < phi2 < 20.5

    1. Initial program 71.2%

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

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

      \[\leadsto \color{blue}{R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)} \]
    4. Step-by-step derivation
      1. sin-mult71.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 20.5 < phi2

    1. Initial program 40.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. Step-by-step derivation
      1. associate-*l*40.6%

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. associate--r+41.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -780000000000:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\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(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\ \mathbf{elif}\;\phi_2 \leq 20.5:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{{\cos \left(\phi_1 \cdot 0.5\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \cos \left(\lambda_1 - \lambda_2\right)}{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\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)}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\ \end{array} \]

Alternative 2: 63.3% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_2 + t_0 \cdot \left(t_1 \cdot t_1\right)}}{\sqrt{\left(1 - t_2\right) + t_0 \cdot \frac{\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right) + -1}{2}}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 59.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. Step-by-step derivation
    1. associate-*l*59.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}}\right) \]
  6. Step-by-step derivation
    1. +-inverses59.2%

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

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

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

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{1 - \cos \left(\lambda_1 - \lambda_2\right)}{2}}}}\right) \]
  8. Step-by-step derivation
    1. cos-diff59.7%

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

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

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

Alternative 3: 62.8% accurate, 0.9× speedup?

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

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_2 + t_0 \cdot \left(t_1 \cdot t_1\right)}}{\sqrt{\left(1 - t_2\right) - t_0 \cdot \frac{e^{\mathsf{log1p}\left(-\cos \left(\lambda_1 - \lambda_2\right)\right)}}{2}}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 59.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. Step-by-step derivation
    1. associate-*l*59.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}}\right) \]
  6. Step-by-step derivation
    1. +-inverses59.2%

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

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

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

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{1 - \cos \left(\lambda_1 - \lambda_2\right)}{2}}}}\right) \]
  8. Step-by-step derivation
    1. cos-diff59.7%

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \color{blue}{\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)}}{2}}}\right) \]
  10. Step-by-step derivation
    1. add-exp-log59.7%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{e^{\log \color{blue}{\left(1 + \left(-\left(\cos \lambda_1 \cdot \cos \lambda_2 + \sin \lambda_1 \cdot \sin \lambda_2\right)\right)\right)}}}{2}}}\right) \]
    3. log1p-def59.7%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{e^{\mathsf{log1p}\left(-\color{blue}{\cos \left(\lambda_1 - \lambda_2\right)}\right)}}{2}}}\right) \]
  11. Applied egg-rr59.2%

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

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

Alternative 4: 53.5% accurate, 1.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + t_2 \cdot \left(t_3 \cdot \sin \left(\lambda_2 \cdot -0.5\right)\right)}}{\sqrt{t_1 + t_2 \cdot \frac{\cos \lambda_2 + -1}{2}}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda1 < -2.9e-11

    1. Initial program 45.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. Step-by-step derivation
      1. associate-*l*45.3%

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

      \[\leadsto \color{blue}{R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)} \]
    4. Step-by-step derivation
      1. sin-mult45.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -2.9e-11 < lambda1

    1. Initial program 65.5%

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

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

      \[\leadsto \color{blue}{R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)} \]
    4. Step-by-step derivation
      1. sin-mult65.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}}\right) \]
    6. Step-by-step derivation
      1. +-inverses65.6%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{\color{blue}{1} - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}\right) \]
      3. distribute-lft-out65.6%

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \color{blue}{\cos \left(-\lambda_2\right)}}{2}}}\right) \]
    9. Step-by-step derivation
      1. cos-neg54.6%

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

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

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

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

Alternative 5: 55.7% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
t_1 := 1 - t_0\\
t_2 := \cos \phi_1 \cdot \cos \phi_2\\
t_3 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
\mathbf{if}\;\lambda_2 \leq 3.6 \cdot 10^{-7}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + t_2 \cdot \left(t_3 \cdot t_3\right)}}{\sqrt{t_1 + t_2 \cdot \frac{\cos \lambda_1 + -1}{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + t_2 \cdot {\sin \left(\lambda_2 \cdot -0.5\right)}^{2}}}{\sqrt{t_1 + t_2 \cdot \frac{\cos \lambda_2 + -1}{2}}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda2 < 3.59999999999999994e-7

    1. Initial program 67.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{\color{blue}{1} - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}\right) \]
      3. distribute-lft-out67.5%

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

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

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

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

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

    if 3.59999999999999994e-7 < lambda2

    1. Initial program 38.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. Step-by-step derivation
      1. associate-*l*38.8%

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

      \[\leadsto \color{blue}{R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)} \]
    4. Step-by-step derivation
      1. sin-mult38.8%

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

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

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

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

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

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}}\right) \]
    6. Step-by-step derivation
      1. +-inverses38.8%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{\color{blue}{1} - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}\right) \]
      3. distribute-lft-out38.8%

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \color{blue}{\cos \left(-\lambda_2\right)}}{2}}}\right) \]
    9. Step-by-step derivation
      1. cos-neg39.0%

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\lambda_2 \leq 3.6 \cdot 10^{-7}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{\cos \lambda_1 + -1}{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot {\sin \left(\lambda_2 \cdot -0.5\right)}^{2}}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{\cos \lambda_2 + -1}{2}}}\right)\\ \end{array} \]

Alternative 6: 62.8% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_2 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_2 + t_0 \cdot \left(t_1 \cdot t_1\right)}}{\sqrt{\left(1 - t_2\right) - t_0 \cdot \frac{1 - \cos \left(\lambda_1 - \lambda_2\right)}{2}}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 59.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. Step-by-step derivation
    1. associate-*l*59.1%

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}}\right) \]
  6. Step-by-step derivation
    1. +-inverses59.2%

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

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

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

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

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

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

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

Alternative 7: 63.0% accurate, 1.1× speedup?

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

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

\mathbf{elif}\;\phi_2 \leq 20.5:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_3}{\sqrt{{\cos \left(\phi_1 \cdot 0.5\right)}^{2} - \cos \phi_1 \cdot t_0}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_3}{t_4}\right)\\


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

    1. Initial program 50.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. Step-by-step derivation
      1. associate-*l*50.6%

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. associate--r+51.5%

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

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

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

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

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

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

    if -1.60000000000000013e-4 < phi2 < 20.5

    1. Initial program 71.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. Step-by-step derivation
      1. associate-*l*71.6%

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. associate--r+71.6%

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

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

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

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

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

    if 20.5 < phi2

    1. Initial program 40.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. Step-by-step derivation
      1. associate-*l*40.6%

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. associate--r+41.7%

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -0.00016:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\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(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\ \mathbf{elif}\;\phi_2 \leq 20.5:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{{\cos \left(\phi_1 \cdot 0.5\right)}^{2} - \cos \phi_1 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\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)}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\ \end{array} \]

Alternative 8: 51.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
\mathbf{if}\;\lambda_1 \leq -7.5 \cdot 10^{-5}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\phi_2 \cdot -0.5\right)}^{2} + \cos \phi_2 \cdot {\sin \left(\lambda_1 \cdot 0.5\right)}^{2}}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + t_0 \cdot {\sin \left(\lambda_2 \cdot -0.5\right)}^{2}}}{\sqrt{\left(1 - t_1\right) + t_0 \cdot \frac{\cos \lambda_2 + -1}{2}}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda1 < -7.49999999999999934e-5

    1. Initial program 45.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. Step-by-step derivation
      1. associate-*l*45.3%

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. associate--r+40.9%

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    7. Step-by-step derivation
      1. add-log-exp40.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\log \left(e^{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      2. div-inv40.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\log \left(e^{\sin \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}\right)}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      3. metadata-eval40.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\log \left(e^{\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}\right)}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    8. Applied egg-rr40.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\log \left(e^{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}\right)}}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    9. Taylor expanded in lambda2 around 0 40.9%

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

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

    if -7.49999999999999934e-5 < lambda1

    1. Initial program 65.5%

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

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

      \[\leadsto \color{blue}{R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)} \]
    4. Step-by-step derivation
      1. sin-mult65.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}}\right) \]
    6. Step-by-step derivation
      1. +-inverses65.6%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{\color{blue}{1} - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}\right) \]
      3. distribute-lft-out65.6%

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \color{blue}{\cos \left(-\lambda_2\right)}}{2}}}\right) \]
    9. Step-by-step derivation
      1. cos-neg54.6%

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

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

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

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

Alternative 9: 51.3% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\
\mathbf{if}\;\lambda_1 \leq -2.6 \cdot 10^{-6}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\phi_2 \cdot -0.5\right)}^{2} + \cos \phi_2 \cdot {\sin \left(\lambda_1 \cdot 0.5\right)}^{2}}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_1 + t_0 \cdot \frac{1 - \cos \left(\lambda_1 - \lambda_2\right)}{2}}}{\sqrt{\left(1 - t_1\right) + t_0 \cdot \frac{\cos \lambda_2 + -1}{2}}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda1 < -2.60000000000000009e-6

    1. Initial program 45.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. Step-by-step derivation
      1. associate-*l*45.3%

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. associate--r+40.9%

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    7. Step-by-step derivation
      1. add-log-exp40.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\log \left(e^{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      2. div-inv40.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\log \left(e^{\sin \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}\right)}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      3. metadata-eval40.9%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\log \left(e^{\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}\right)}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    8. Applied egg-rr40.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\log \left(e^{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}\right)}}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    9. Taylor expanded in lambda2 around 0 40.9%

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

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

    if -2.60000000000000009e-6 < lambda1

    1. Initial program 65.5%

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

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

      \[\leadsto \color{blue}{R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)} \]
    4. Step-by-step derivation
      1. sin-mult65.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}}\right) \]
    6. Step-by-step derivation
      1. +-inverses65.6%

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{\color{blue}{1} - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}\right) \]
      3. distribute-lft-out65.6%

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \color{blue}{\cos \left(-\lambda_2\right)}}{2}}}\right) \]
    9. Step-by-step derivation
      1. cos-neg54.6%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{1 - \color{blue}{\cos \lambda_2}}{2}}}\right) \]
    11. Step-by-step derivation
      1. sin-mult65.6%

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\left(1 - {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \frac{\color{blue}{1} - \cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 + \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}{2}}}\right) \]
      3. distribute-lft-out65.6%

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

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

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

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

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

Alternative 10: 44.4% accurate, 1.2× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t_1 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_1\right)}}{\sqrt{1 - t_0}}\right)\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi2 < -7.8e11 or 0.170000000000000012 < phi2

    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. Step-by-step derivation
      1. associate-*l*45.6%

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    5. Step-by-step derivation
      1. associate--r+46.6%

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

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

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

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    7. Step-by-step derivation
      1. add-log-exp46.6%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\log \left(e^{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      2. div-inv46.6%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\log \left(e^{\sin \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}\right)}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      3. metadata-eval46.6%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\log \left(e^{\sin \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}\right)}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    8. Applied egg-rr46.6%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\log \left(e^{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}\right)}}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    9. Taylor expanded in lambda2 around 0 40.4%

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

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

    if -7.8e11 < phi2 < 0.170000000000000012

    1. Initial program 71.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. Taylor expanded in phi2 around 0 71.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{1 - \left({\color{blue}{\sin \left(0.5 \cdot \phi_1\right)}}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\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. Taylor expanded in phi1 around 0 48.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}{1 - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    4. Step-by-step derivation
      1. *-commutative48.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{1 - \color{blue}{{\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_2}}}\right) \]
    5. Simplified48.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}{1 - {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_2}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification45.3%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -780000000000 \lor \neg \left(\phi_2 \leq 0.17\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\phi_2 \cdot -0.5\right)}^{2} + \cos \phi_2 \cdot {\sin \left(\lambda_1 \cdot 0.5\right)}^{2}}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{1 - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)\\ \end{array} \]

Alternative 11: 34.7% accurate, 1.4× speedup?

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

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
  5. Step-by-step derivation
    1. associate--r+47.7%

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

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

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

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{1 - {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  8. Final simplification34.3%

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

Alternative 12: 14.4% accurate, 1.9× speedup?

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

\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}}}\right)
\end{array}
Derivation
  1. Initial program 59.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. Step-by-step derivation
    1. associate-*l*59.1%

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\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)}}{\sqrt{\color{blue}{1 - \left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
  5. Step-by-step derivation
    1. associate--r+47.7%

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

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

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

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \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)}}{\sqrt{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  7. Step-by-step derivation
    1. add-log-exp45.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\log \left(e^{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\right)}}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    2. div-inv45.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\log \left(e^{\sin \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}\right)}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    3. metadata-eval45.8%

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\color{blue}{\log \left(e^{\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}\right)}}^{2} + \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)}}{\sqrt{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
  9. Taylor expanded in lambda2 around 0 37.0%

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

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

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

Alternative 13: 8.8% accurate, 2.1× speedup?

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

\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\phi_2 \cdot \left(0.5 \cdot \cos \left(\phi_1 \cdot 0.5\right)\right)}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} + -0.5 \cdot \left(\cos \phi_2 \cdot \left(1 - \cos \left(\lambda_1 - \lambda_2\right)\right)\right)}}\right)
\end{array}
Derivation
  1. Initial program 59.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. Step-by-step derivation
    1. Simplified59.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Reproduce

    ?
    herbie shell --seed 2023200 
    (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))))))))))