Distance on a great circle

Percentage Accurate: 61.8% → 78.0%
Time: 2.0min
Alternatives: 21
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 21 alternatives:

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

Initial Program: 61.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: 78.0% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda2 < -0.0379999999999999991 or 0.047 < lambda2

    1. Initial program 53.2%

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

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

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

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

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

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

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

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

    if -0.0379999999999999991 < lambda2 < 0.047

    1. Initial program 76.0%

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

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

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

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

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

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

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

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

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

Alternative 2: 77.0% accurate, 0.7× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda1 < -3.7e-8 or 2.8999999999999998e-7 < lambda1

    1. Initial program 54.3%

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

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

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

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

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

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

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

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

    if -3.7e-8 < lambda1 < 2.8999999999999998e-7

    1. Initial program 76.6%

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

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

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

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

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

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

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

Alternative 3: 71.7% accurate, 0.7× speedup?

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

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

\mathbf{elif}\;\lambda_1 \leq 8 \cdot 10^{-5}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot \left(\cos \phi_2 \cdot {\sin \left(\lambda_2 \cdot -0.5\right)}^{2}\right) + {\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \sin \left(\phi_1 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}}}{t\_3}\right)\\

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


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

    1. Initial program 55.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -5.00000000000000041e-6 < lambda1 < 8.00000000000000065e-5

    1. Initial program 76.6%

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

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

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

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

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

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

    if 8.00000000000000065e-5 < lambda1

    1. Initial program 52.4%

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

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

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

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

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

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

Alternative 4: 78.2% accurate, 0.7× speedup?

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

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

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

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

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

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

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

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

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

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

Alternative 5: 62.9% accurate, 0.8× speedup?

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

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

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

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

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

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

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

Alternative 6: 62.9% accurate, 0.8× speedup?

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

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t\_0 \cdot t\_0\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_1}}{\sqrt{\left(1 - {\left(\sin \left(\frac{\phi_1}{2}\right) \cdot \cos \left(\frac{\phi_2}{2}\right) - \cos \left(\frac{\phi_1}{2}\right) \cdot \sin \left(\frac{\phi_2}{2}\right)\right)}^{2}\right) - t\_1}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Step-by-step derivation
    1. div-sub65.8%

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

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

Alternative 7: 62.8% accurate, 0.9× speedup?

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 8: 61.9% accurate, 1.1× speedup?

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

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t\_0 \cdot t\_0\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_1}}{\sqrt{\left(1 - \left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)\right) - t\_1}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Step-by-step derivation
    1. unpow265.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 - \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
    2. sin-mult65.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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    7. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    8. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    9. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
    10. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Applied egg-rr65.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}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}}\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) \]
  7. Step-by-step derivation
    1. div-sub65.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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
    2. +-inverses65.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
    3. cos-065.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval65.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-lft-out65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
    7. *-rgt-identity65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
  8. Simplified65.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}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right)}\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) \]
  9. Add Preprocessing

Alternative 9: 57.8% accurate, 1.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_1}}{\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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi1 < -0.0071999999999999998 or 0.0071000000000000004 < phi1

    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. Add Preprocessing
    5. Taylor expanded in phi2 around 0 50.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 \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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. unpow250.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 \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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      2. 1-sub-sin50.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_1\right) \cdot \cos \left(0.5 \cdot \phi_1\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) \]
      3. unpow250.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    7. Simplified50.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    8. Taylor expanded in lambda2 around 0 38.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(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + -0.5 \cdot \left(\lambda_2 \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    9. Step-by-step derivation
      1. associate-*r*38.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(\left(\sin \left(0.5 \cdot \lambda_1\right) + \color{blue}{\left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    10. Simplified38.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(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + \left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    11. Taylor expanded in lambda2 around 0 42.4%

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

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

    if -0.0071999999999999998 < phi1 < 0.0071000000000000004

    1. Initial program 81.9%

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

        \[\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. Simplified81.9%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 81.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}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative81.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+81.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}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow281.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{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin81.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{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow281.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{\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. Simplified81.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{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification61.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -0.0072 \lor \neg \left(\phi_1 \leq 0.0071\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot {\sin \left(\lambda_1 \cdot 0.5\right)}^{2} + {\sin \left(\phi_1 \cdot 0.5\right)}^{2}}}{\sqrt{{\cos \left(\phi_1 \cdot 0.5\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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)\\ \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} \]
  5. Add Preprocessing

Alternative 10: 62.3% accurate, 1.1× speedup?

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

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

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

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


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

    1. Initial program 42.3%

      \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    2. Step-by-step derivation
      1. associate-*l*42.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. Simplified42.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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 43.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 \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(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative43.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+43.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 \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) \]
      3. unpow243.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 \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) \]
      4. 1-sub-sin43.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) \]
      5. unpow243.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. Simplified43.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) \]
    8. Step-by-step derivation
      1. unpow242.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(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
      2. sin-mult42.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 \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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. div-inv42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. div-inv42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      7. div-inv42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      8. metadata-eval42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      9. div-inv42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
      10. metadata-eval42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
    9. Applied egg-rr43.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
    10. Step-by-step derivation
      1. div-sub42.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 \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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
      2. +-inverses42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
      3. cos-042.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. distribute-lft-out42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
      7. *-rgt-identity42.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
    11. Simplified43.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
    12. Step-by-step derivation
      1. sin-mult42.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 \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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. div-inv42.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. metadata-eval42.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. div-inv42.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. metadata-eval42.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      6. cos-sum42.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      7. cos-242.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      8. div-inv42.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      9. metadata-eval42.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    13. Applied egg-rr43.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\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) \]
    14. Step-by-step derivation
      1. +-inverses42.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. cos-042.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. div-sub42.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 \color{blue}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. metadata-eval42.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. *-commutative42.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    15. Simplified43.5%

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

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

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

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

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

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

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

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

    1. Initial program 88.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*88.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. Simplified88.5%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi2 around 0 88.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 \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(\cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative88.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(0.5 \cdot \phi_1\right)}^{2} + \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+88.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_1\right)}^{2}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow288.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_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\right) - \cos \phi_1 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin88.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) \]
      5. unpow288.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. *-commutative88.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{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \color{blue}{{\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1}}}\right) \]
    7. Simplified88.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} - {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} \cdot \cos \phi_1}}}\right) \]

    if 0.034000000000000002 < phi2

    1. Initial program 50.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*50.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. Simplified50.0%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 50.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}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative50.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+50.7%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
      3. unpow250.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) \]
      4. 1-sub-sin50.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) \]
      5. unpow250.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. Simplified50.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) \]
    8. Taylor expanded in phi1 around 0 51.3%

      \[\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) \]
  3. Recombined 3 regimes into one program.
  4. Final simplification66.5%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_2 \leq -4.6 \cdot 10^{-9}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot e^{\log \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_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)\\ \mathbf{elif}\;\phi_2 \leq 0.034:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\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{\left(\cos \phi_1 \cdot \cos \phi_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)\\ \end{array} \]
  5. Add Preprocessing

Alternative 11: 56.2% accurate, 1.1× speedup?

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi1 < -1.39999999999999994e-25 or 0.0043 < phi1

    1. Initial program 52.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*52.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. Simplified52.9%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi2 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}{\left(1 - {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)} - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. 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_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\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) \]
      2. 1-sub-sin51.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_1\right) \cdot \cos \left(0.5 \cdot \phi_1\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) \]
      3. unpow251.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    7. Simplified51.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    8. Taylor expanded in lambda2 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 \left(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + -0.5 \cdot \left(\lambda_2 \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    9. Step-by-step derivation
      1. associate-*r*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 \left(\left(\sin \left(0.5 \cdot \lambda_1\right) + \color{blue}{\left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    10. Simplified39.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(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + \left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    11. Taylor expanded in lambda2 around 0 43.4%

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

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

    if -1.39999999999999994e-25 < phi1 < 0.0043

    1. Initial program 81.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*81.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. Simplified81.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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 80.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(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative80.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+80.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) \]
      3. unpow280.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) \]
      4. 1-sub-sin81.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) \]
      5. unpow281.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. Simplified81.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) \]
    8. Taylor expanded in phi1 around 0 79.5%

      \[\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) \]
  3. Recombined 2 regimes into one program.
  4. Final simplification59.9%

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -1.4 \cdot 10^{-25} \lor \neg \left(\phi_1 \leq 0.0043\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot {\sin \left(\lambda_1 \cdot 0.5\right)}^{2} + {\sin \left(\phi_1 \cdot 0.5\right)}^{2}}}{\sqrt{{\cos \left(\phi_1 \cdot 0.5\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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)\\ \mathbf{else}:\\ \;\;\;\;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)\\ \end{array} \]
  5. Add Preprocessing

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

\\
\begin{array}{l}
t_0 := \cos \phi_1 \cdot \cos \phi_2\\
t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t\_0 \cdot \left(t\_1 \cdot t\_1\right)}}{\sqrt{\left(1 - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right) + t\_0 \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Step-by-step derivation
    1. cancel-sign-sub-inv65.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}{\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) \]
    2. div-inv65.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 \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}\right)}}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. metadata-eval65.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(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    4. sqr-sin-a65.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(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\left(0.5 - 0.5 \cdot \cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)\right)}}}\right) \]
    5. cos-265.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 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}\right)}}\right) \]
    6. cos-sum65.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(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \color{blue}{\cos \left(\frac{\lambda_1 - \lambda_2}{2} + \frac{\lambda_1 - \lambda_2}{2}\right)}\right)}}\right) \]
    7. add-log-exp20.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(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(\color{blue}{\log \left(e^{\frac{\lambda_1 - \lambda_2}{2}}\right)} + \frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    8. add-log-exp20.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(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(\log \left(e^{\frac{\lambda_1 - \lambda_2}{2}}\right) + \color{blue}{\log \left(e^{\frac{\lambda_1 - \lambda_2}{2}}\right)}\right)\right)}}\right) \]
    9. sum-log19.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 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \color{blue}{\log \left(e^{\frac{\lambda_1 - \lambda_2}{2}} \cdot e^{\frac{\lambda_1 - \lambda_2}{2}}\right)}\right)}}\right) \]
    10. exp-sqrt19.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 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \log \left(\color{blue}{\sqrt{e^{\lambda_1 - \lambda_2}}} \cdot e^{\frac{\lambda_1 - \lambda_2}{2}}\right)\right)}}\right) \]
    11. exp-sqrt19.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 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \log \left(\sqrt{e^{\lambda_1 - \lambda_2}} \cdot \color{blue}{\sqrt{e^{\lambda_1 - \lambda_2}}}\right)\right)}}\right) \]
  6. Applied egg-rr65.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}{\left(1 - {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right) + \left(-\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)}}}\right) \]
  7. Final simplification65.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(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right) - 0.5\right)}}\right) \]
  8. Add Preprocessing

Alternative 13: 59.5% accurate, 1.1× speedup?

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

\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right)
\end{array}
Derivation
  1. Initial program 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Applied egg-rr65.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}{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)\right)}}}\right) \]
  6. Step-by-step derivation
    1. expm1-undefine65.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}{e^{\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)} - 1}}}\right) \]
    2. sub-neg65.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}{e^{\mathsf{log1p}\left(1 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 - 0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(\left(\phi_1 - \phi_2\right) \cdot 0.5\right)}^{2}\right)\right)} + \left(-1\right)}}}\right) \]
  7. Simplified65.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(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}}\right) \]
  8. Step-by-step derivation
    1. sin-mult64.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}{\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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    2. div-inv64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    3. metadata-eval64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    4. div-inv64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    5. metadata-eval64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    6. cos-sum64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    7. cos-264.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    8. div-inv64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    9. metadata-eval64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  9. Applied egg-rr64.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}{\frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  10. Step-by-step derivation
    1. +-inverses64.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    2. cos-064.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    3. div-sub64.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}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    4. metadata-eval64.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    5. *-commutative64.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  11. Simplified64.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}{\left(0.5 - \frac{\cos \left(2 \cdot \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  12. Final simplification64.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(0.5 - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  13. Add Preprocessing

Alternative 14: 55.0% accurate, 1.1× speedup?

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

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

\mathbf{else}:\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 + \left(0.5 - \frac{\cos \phi_2}{2}\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}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if phi1 < -1.39999999999999994e-25 or 0.00679999999999999962 < phi1

    1. Initial program 52.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*52.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. Simplified52.9%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi2 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}{\left(1 - {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)} - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. 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_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\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) \]
      2. 1-sub-sin51.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_1\right) \cdot \cos \left(0.5 \cdot \phi_1\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) \]
      3. unpow251.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    7. Simplified51.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    8. Taylor expanded in lambda2 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 \left(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + -0.5 \cdot \left(\lambda_2 \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    9. Step-by-step derivation
      1. associate-*r*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 \left(\left(\sin \left(0.5 \cdot \lambda_1\right) + \color{blue}{\left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    10. Simplified39.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(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + \left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    11. Taylor expanded in lambda2 around 0 43.4%

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

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

    if -1.39999999999999994e-25 < phi1 < 0.00679999999999999962

    1. Initial program 81.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*81.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. Simplified81.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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 80.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(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative80.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+80.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) \]
      3. unpow280.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) \]
      4. 1-sub-sin81.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) \]
      5. unpow281.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. Simplified81.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) \]
    8. Step-by-step derivation
      1. unpow281.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 \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(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
      2. sin-mult81.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 \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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. div-inv81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. div-inv81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      7. div-inv81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      8. metadata-eval81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      9. div-inv81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
      10. metadata-eval81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
    9. Applied egg-rr77.8%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
    10. Step-by-step derivation
      1. div-sub81.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 \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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
      2. +-inverses81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
      3. cos-081.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. distribute-lft-out81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
      7. *-rgt-identity81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\left(1 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
    11. Simplified77.8%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\color{blue}{\cos \left(-\phi_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)}}{\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) \]
    13. Step-by-step derivation
      1. cos-neg77.8%

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\color{blue}{\cos \phi_2}}{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)}}{\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) \]
    14. Simplified77.8%

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\phi_1 \leq -1.4 \cdot 10^{-25} \lor \neg \left(\phi_1 \leq 0.0068\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\cos \phi_1 \cdot {\sin \left(\lambda_1 \cdot 0.5\right)}^{2} + {\sin \left(\phi_1 \cdot 0.5\right)}^{2}}}{\sqrt{{\cos \left(\phi_1 \cdot 0.5\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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)\\ \mathbf{else}:\\ \;\;\;\;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) + \left(0.5 - \frac{\cos \phi_2}{2}\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} \]
  5. Add Preprocessing

Alternative 15: 46.6% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
t_0 := {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t\_0}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot t\_0}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Taylor expanded in phi1 around 0 50.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}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
  6. Step-by-step derivation
    1. +-commutative50.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    2. associate--r+50.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}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    3. unpow250.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{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    4. 1-sub-sin50.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{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    5. unpow250.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{\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. Simplified50.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{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  8. Step-by-step derivation
    1. unpow265.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 - \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
    2. sin-mult65.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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    7. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    8. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    9. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
    10. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
  9. Applied egg-rr47.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
  10. Step-by-step derivation
    1. div-sub65.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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
    2. +-inverses65.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
    3. cos-065.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval65.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-lft-out65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
    7. *-rgt-identity65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
  11. Simplified47.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
  12. Step-by-step derivation
    1. pow247.3%

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

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

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

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

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

Alternative 16: 43.2% accurate, 1.2× speedup?

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

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

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

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


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

    1. Initial program 50.0%

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

        \[\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.0%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 20.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(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative20.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+20.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) \]
      3. unpow220.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) \]
      4. 1-sub-sin20.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) \]
      5. unpow220.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. Simplified20.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) \]
    8. Step-by-step derivation
      1. unpow250.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(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
      2. sin-mult50.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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. div-inv50.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval50.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. div-inv50.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval50.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      7. div-inv50.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      8. metadata-eval50.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      9. div-inv50.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
      10. metadata-eval50.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
    9. Applied egg-rr20.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
    10. Step-by-step derivation
      1. div-sub50.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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
      2. +-inverses50.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
      3. cos-050.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval50.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. distribute-lft-out50.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval50.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
      7. *-rgt-identity50.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
    11. Simplified20.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
    12. Step-by-step derivation
      1. sin-mult49.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 \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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. div-inv49.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. metadata-eval49.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. div-inv49.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. metadata-eval49.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      6. cos-sum49.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      7. cos-249.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      8. div-inv49.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      9. metadata-eval49.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    13. Applied egg-rr20.5%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\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) \]
    14. Step-by-step derivation
      1. +-inverses49.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. cos-049.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. div-sub49.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 \color{blue}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. metadata-eval49.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. *-commutative49.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    15. Simplified20.5%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\left(0.5 - 0.5 \cdot \cos \left(-\lambda_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) \]
    17. Step-by-step derivation
      1. cancel-sign-sub-inv20.8%

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

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

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

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

    1. Initial program 81.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*81.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. Simplified81.7%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 81.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 \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(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative81.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 \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+81.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_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow281.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_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin81.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) \]
      5. unpow281.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. Simplified81.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) \]
    8. Step-by-step derivation
      1. unpow281.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(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
      2. sin-mult81.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 - \color{blue}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. div-inv81.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval81.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. div-inv81.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval81.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      7. div-inv81.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      8. metadata-eval81.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      9. div-inv81.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
      10. metadata-eval81.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
    9. Applied egg-rr75.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
    10. Step-by-step derivation
      1. div-sub81.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 - \color{blue}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
      2. +-inverses81.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
      3. cos-081.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval81.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. distribute-lft-out81.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval81.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
      7. *-rgt-identity81.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
    11. Simplified75.4%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
    12. Step-by-step derivation
      1. sin-mult78.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 \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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. div-inv78.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. metadata-eval78.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. div-inv78.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. metadata-eval78.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      6. cos-sum78.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      7. cos-278.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      8. div-inv78.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      9. metadata-eval78.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    13. Applied egg-rr71.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\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) \]
    14. Step-by-step derivation
      1. +-inverses78.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. cos-078.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. div-sub78.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 \color{blue}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. metadata-eval78.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. *-commutative78.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    15. Simplified71.9%

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

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

        \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\color{blue}{\cos \phi_2}}{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)}}{\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) \]
    18. Simplified71.9%

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

    1. Initial program 51.9%

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

        \[\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.9%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi2 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}{\left(1 - {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right)} - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. Step-by-step derivation
      1. 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_1\right) \cdot \sin \left(0.5 \cdot \phi_1\right)}\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) \]
      2. 1-sub-sin51.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_1\right) \cdot \cos \left(0.5 \cdot \phi_1\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) \]
      3. unpow251.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    7. Simplified51.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    8. Taylor expanded in lambda2 around 0 38.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(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + -0.5 \cdot \left(\lambda_2 \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    9. Step-by-step derivation
      1. associate-*r*38.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(\left(\sin \left(0.5 \cdot \lambda_1\right) + \color{blue}{\left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    10. Simplified38.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(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + \left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    11. Taylor expanded in lambda2 around 0 42.2%

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

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

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

Alternative 17: 43.4% accurate, 1.2× speedup?

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

\\
\begin{array}{l}
t_0 := \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}}\\
t_1 := 0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\\
t_2 := \cos \phi_1 \cdot \cos \phi_2\\
\mathbf{if}\;\lambda_2 \leq -0.038 \lor \neg \left(\lambda_2 \leq 3.4 \cdot 10^{-53}\right):\\
\;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t\_1 + t\_2 \cdot \left(0.5 + -0.5 \cdot \cos \lambda_2\right)}}{t\_0}\right)\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if lambda2 < -0.0379999999999999991 or 3.4e-53 < lambda2

    1. Initial program 52.9%

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

        \[\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. Simplified52.9%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 43.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}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative43.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+43.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}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
      3. unpow243.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{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      4. 1-sub-sin43.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{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
      5. unpow243.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{\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. Simplified43.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{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    8. Step-by-step derivation
      1. unpow252.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(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
      2. sin-mult53.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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. div-inv53.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval53.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. div-inv53.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval53.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      7. div-inv53.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      8. metadata-eval53.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      9. div-inv53.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
      10. metadata-eval53.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
    9. Applied egg-rr43.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
    10. Step-by-step derivation
      1. div-sub53.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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
      2. +-inverses53.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
      3. cos-053.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval53.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. distribute-lft-out53.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval53.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
      7. *-rgt-identity53.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
    11. Simplified43.2%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
    12. Step-by-step derivation
      1. sin-mult52.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}{\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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. div-inv52.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. metadata-eval52.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. div-inv52.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. metadata-eval52.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      6. cos-sum52.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      7. cos-252.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      8. div-inv52.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      9. metadata-eval52.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    13. Applied egg-rr43.1%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\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) \]
    14. Step-by-step derivation
      1. +-inverses52.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. cos-052.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. div-sub52.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}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. metadata-eval52.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. *-commutative52.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    15. Simplified43.1%

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

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\left(0.5 - 0.5 \cdot \cos \left(-\lambda_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) \]
    17. Step-by-step derivation
      1. cancel-sign-sub-inv43.3%

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

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

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

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

    1. Initial program 77.7%

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

        \[\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. Simplified77.7%

      \[\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. Add Preprocessing
    5. Taylor expanded in phi1 around 0 56.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(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
    6. Step-by-step derivation
      1. +-commutative56.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
      2. associate--r+56.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) \]
      3. unpow256.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) \]
      4. 1-sub-sin56.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) \]
      5. unpow256.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. Simplified56.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) \]
    8. Step-by-step derivation
      1. unpow277.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(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
      2. sin-mult77.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 - \color{blue}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      3. div-inv77.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval77.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. div-inv77.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval77.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      7. div-inv77.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      8. metadata-eval77.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
      9. div-inv77.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
      10. metadata-eval77.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
    9. Applied egg-rr51.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
    10. Step-by-step derivation
      1. div-sub77.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 - \color{blue}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
      2. +-inverses77.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
      3. cos-077.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval77.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      5. distribute-lft-out77.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
      6. metadata-eval77.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
      7. *-rgt-identity77.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
    11. Simplified51.0%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
    12. Step-by-step derivation
      1. sin-mult74.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 \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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. div-inv74.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. metadata-eval74.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. div-inv74.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. metadata-eval74.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      6. cos-sum74.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      7. cos-274.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      8. div-inv74.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      9. metadata-eval74.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    13. Applied egg-rr47.9%

      \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\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) \]
    14. Step-by-step derivation
      1. +-inverses74.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      2. cos-074.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      3. div-sub74.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 \color{blue}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      4. metadata-eval74.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
      5. *-commutative74.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    15. Simplified47.9%

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

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

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

Alternative 18: 44.3% accurate, 1.3× speedup?

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

\\
\begin{array}{l}
t_0 := \left(\lambda_1 - \lambda_2\right) \cdot 0.5\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 - \frac{\cos \left(2 \cdot t\_0\right)}{2}\right)}}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} - \cos \phi_2 \cdot {\sin t\_0}^{2}}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Taylor expanded in phi1 around 0 50.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}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
  6. Step-by-step derivation
    1. +-commutative50.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    2. associate--r+50.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}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    3. unpow250.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{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    4. 1-sub-sin50.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{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    5. unpow250.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{\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. Simplified50.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{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  8. Step-by-step derivation
    1. unpow265.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 - \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
    2. sin-mult65.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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    7. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    8. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    9. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
    10. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
  9. Applied egg-rr47.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
  10. Step-by-step derivation
    1. div-sub65.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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
    2. +-inverses65.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
    3. cos-065.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval65.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-lft-out65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
    7. *-rgt-identity65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
  11. Simplified47.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
  12. Step-by-step derivation
    1. sin-mult64.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}{\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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    2. div-inv64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    3. metadata-eval64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    4. div-inv64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    5. metadata-eval64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    6. cos-sum64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    7. cos-264.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    8. div-inv64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    9. metadata-eval64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  13. Applied egg-rr45.6%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\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) \]
  14. Step-by-step derivation
    1. +-inverses64.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    2. cos-064.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    3. div-sub64.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}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    4. metadata-eval64.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    5. *-commutative64.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  15. Simplified45.6%

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

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

Alternative 19: 44.2% accurate, 1.3× speedup?

\[\begin{array}{l} \\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(-1 + \left(1.5 - 0.5 \cdot \cos \left(\lambda_2 - \lambda_1\right)\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} \]
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (*
  R
  (*
   2.0
   (atan2
    (sqrt
     (+
      (- 0.5 (/ (cos (- phi1 phi2)) 2.0))
      (*
       (* (cos phi1) (cos phi2))
       (+ -1.0 (- 1.5 (* 0.5 (cos (- lambda2 lambda1))))))))
    (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(sqrt(((0.5 - (cos((phi1 - phi2)) / 2.0)) + ((cos(phi1) * cos(phi2)) * (-1.0 + (1.5 - (0.5 * cos((lambda2 - lambda1)))))))), 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(sqrt(((0.5d0 - (cos((phi1 - phi2)) / 2.0d0)) + ((cos(phi1) * cos(phi2)) * ((-1.0d0) + (1.5d0 - (0.5d0 * cos((lambda2 - lambda1)))))))), 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.sqrt(((0.5 - (Math.cos((phi1 - phi2)) / 2.0)) + ((Math.cos(phi1) * Math.cos(phi2)) * (-1.0 + (1.5 - (0.5 * Math.cos((lambda2 - lambda1)))))))), 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.sqrt(((0.5 - (math.cos((phi1 - phi2)) / 2.0)) + ((math.cos(phi1) * math.cos(phi2)) * (-1.0 + (1.5 - (0.5 * math.cos((lambda2 - lambda1)))))))), 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(sqrt(Float64(Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)) + Float64(Float64(cos(phi1) * cos(phi2)) * Float64(-1.0 + Float64(1.5 - Float64(0.5 * cos(Float64(lambda2 - lambda1)))))))), 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(sqrt(((0.5 - (cos((phi1 - phi2)) / 2.0)) + ((cos(phi1) * cos(phi2)) * (-1.0 + (1.5 - (0.5 * cos((lambda2 - lambda1)))))))), 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[Sqrt[N[(N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[(-1.0 + N[(1.5 - N[(0.5 * N[Cos[N[(lambda2 - lambda1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $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]
\begin{array}{l}

\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(-1 + \left(1.5 - 0.5 \cdot \cos \left(\lambda_2 - \lambda_1\right)\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}
Derivation
  1. Initial program 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Taylor expanded in phi1 around 0 50.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}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
  6. Step-by-step derivation
    1. +-commutative50.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    2. associate--r+50.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}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    3. unpow250.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{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    4. 1-sub-sin50.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{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    5. unpow250.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{\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. Simplified50.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{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  8. Step-by-step derivation
    1. unpow265.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 - \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
    2. sin-mult65.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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    7. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    8. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    9. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
    10. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
  9. Applied egg-rr47.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
  10. Step-by-step derivation
    1. div-sub65.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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
    2. +-inverses65.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
    3. cos-065.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval65.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-lft-out65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
    7. *-rgt-identity65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
  11. Simplified47.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
  12. Step-by-step derivation
    1. sin-mult64.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}{\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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    2. div-inv64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    3. metadata-eval64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    4. div-inv64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    5. metadata-eval64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    6. cos-sum64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    7. cos-264.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    8. div-inv64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    9. metadata-eval64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  13. Applied egg-rr45.6%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\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) \]
  14. Step-by-step derivation
    1. +-inverses64.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    2. cos-064.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    3. div-sub64.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}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    4. metadata-eval64.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    5. *-commutative64.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  15. Simplified45.6%

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 20: 34.3% accurate, 1.3× speedup?

\[\begin{array}{l} \\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 + -0.5 \cdot \cos \lambda_2\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
    (sqrt
     (+
      (- 0.5 (/ (cos (- phi1 phi2)) 2.0))
      (* (* (cos phi1) (cos phi2)) (+ 0.5 (* -0.5 (cos lambda2))))))
    (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(sqrt(((0.5 - (cos((phi1 - phi2)) / 2.0)) + ((cos(phi1) * cos(phi2)) * (0.5 + (-0.5 * cos(lambda2)))))), 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(sqrt(((0.5d0 - (cos((phi1 - phi2)) / 2.0d0)) + ((cos(phi1) * cos(phi2)) * (0.5d0 + ((-0.5d0) * cos(lambda2)))))), 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.sqrt(((0.5 - (Math.cos((phi1 - phi2)) / 2.0)) + ((Math.cos(phi1) * Math.cos(phi2)) * (0.5 + (-0.5 * Math.cos(lambda2)))))), 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.sqrt(((0.5 - (math.cos((phi1 - phi2)) / 2.0)) + ((math.cos(phi1) * math.cos(phi2)) * (0.5 + (-0.5 * math.cos(lambda2)))))), 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(sqrt(Float64(Float64(0.5 - Float64(cos(Float64(phi1 - phi2)) / 2.0)) + Float64(Float64(cos(phi1) * cos(phi2)) * Float64(0.5 + Float64(-0.5 * cos(lambda2)))))), 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(sqrt(((0.5 - (cos((phi1 - phi2)) / 2.0)) + ((cos(phi1) * cos(phi2)) * (0.5 + (-0.5 * cos(lambda2)))))), 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[Sqrt[N[(N[(0.5 - N[(N[Cos[N[(phi1 - phi2), $MachinePrecision]], $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[(0.5 + N[(-0.5 * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $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]
\begin{array}{l}

\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(0.5 + -0.5 \cdot \cos \lambda_2\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 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Taylor expanded in phi1 around 0 50.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}{1 - \left(\cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2} + {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right)}}}\right) \]
  6. Step-by-step derivation
    1. +-commutative50.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{1 - \color{blue}{\left({\sin \left(-0.5 \cdot \phi_2\right)}^{2} + \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}\right)}}}\right) \]
    2. associate--r+50.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}{\left(1 - {\sin \left(-0.5 \cdot \phi_2\right)}^{2}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
    3. unpow250.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{\left(1 - \color{blue}{\sin \left(-0.5 \cdot \phi_2\right) \cdot \sin \left(-0.5 \cdot \phi_2\right)}\right) - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    4. 1-sub-sin50.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{\color{blue}{\cos \left(-0.5 \cdot \phi_2\right) \cdot \cos \left(-0.5 \cdot \phi_2\right)} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}\right) \]
    5. unpow250.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{\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. Simplified50.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{\color{blue}{{\cos \left(-0.5 \cdot \phi_2\right)}^{2} - \cos \phi_2 \cdot {\sin \left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}^{2}}}}\right) \]
  8. Step-by-step derivation
    1. unpow265.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 - \color{blue}{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}\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) \]
    2. sin-mult65.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}{\frac{\cos \left(\frac{\phi_1 - \phi_2}{2} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    3. div-inv65.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 - \frac{\cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} - \frac{\phi_1 - \phi_2}{2}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right) - \cos \left(\frac{\phi_1 - \phi_2}{2} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    7. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    8. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5} + \frac{\phi_1 - \phi_2}{2}\right)}{2}\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) \]
    9. div-inv65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \color{blue}{\left(\phi_1 - \phi_2\right) \cdot \frac{1}{2}}\right)}{2}\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) \]
    10. metadata-eval65.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 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot \color{blue}{0.5}\right)}{2}\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) \]
  9. Applied egg-rr47.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right) - \cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}} + \left(\cos \phi_1 \cdot \cos \phi_2\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) \]
  10. Step-by-step derivation
    1. div-sub65.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}{\left(\frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 - \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)}\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) \]
    2. +-inverses65.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 - \left(\frac{\cos \color{blue}{0}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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) \]
    3. cos-065.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 - \left(\frac{\color{blue}{1}}{2} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\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. metadata-eval65.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 - \left(\color{blue}{0.5} - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot 0.5 + \left(\phi_1 - \phi_2\right) \cdot 0.5\right)}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    5. distribute-lft-out65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\left(\phi_1 - \phi_2\right) \cdot \left(0.5 + 0.5\right)\right)}}{2}\right)\right) - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
    6. metadata-eval65.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 - \left(0.5 - \frac{\cos \left(\left(\phi_1 - \phi_2\right) \cdot \color{blue}{1}\right)}{2}\right)\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) \]
    7. *-rgt-identity65.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 - \left(0.5 - \frac{\cos \color{blue}{\left(\phi_1 - \phi_2\right)}}{2}\right)\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) \]
  11. Simplified47.3%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\color{blue}{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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)}}{\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) \]
  12. Step-by-step derivation
    1. sin-mult64.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}{\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}}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    2. div-inv64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    3. metadata-eval64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    4. div-inv64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    5. metadata-eval64.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 \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}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    6. cos-sum64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\left(\cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \left(\frac{\lambda_1 - \lambda_2}{2}\right) - \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    7. cos-264.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \color{blue}{\cos \left(2 \cdot \frac{\lambda_1 - \lambda_2}{2}\right)}}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    8. div-inv64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \color{blue}{\left(\left(\lambda_1 - \lambda_2\right) \cdot \frac{1}{2}\right)}\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    9. metadata-eval64.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 \frac{\cos \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5 - \left(\lambda_1 - \lambda_2\right) \cdot 0.5\right) - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \color{blue}{0.5}\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  13. Applied egg-rr45.6%

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_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(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\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) \]
  14. Step-by-step derivation
    1. +-inverses64.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 \frac{\cos \color{blue}{0} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    2. cos-064.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 \frac{\color{blue}{1} - \cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    3. div-sub64.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}{\left(\frac{1}{2} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    4. metadata-eval64.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(\color{blue}{0.5} - \frac{\cos \left(2 \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
    5. *-commutative64.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(0.5 - \frac{\cos \left(2 \cdot \color{blue}{\left(0.5 \cdot \left(\lambda_1 - \lambda_2\right)\right)}\right)}{2}\right)}}{\sqrt{\left(2 - \mathsf{fma}\left(\cos \phi_1, \cos \phi_2 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right), {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)\right) + -1}}\right) \]
  15. Simplified45.6%

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

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\left(0.5 - \frac{\cos \left(\phi_1 - \phi_2\right)}{2}\right) + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \color{blue}{\left(0.5 - 0.5 \cdot \cos \left(-\lambda_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) \]
  17. Step-by-step derivation
    1. cancel-sign-sub-inv34.1%

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

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

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

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

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

Alternative 21: 13.8% accurate, 1.7× speedup?

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

\\
\begin{array}{l}
t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}{\sqrt{{\cos \left(\phi_1 \cdot 0.5\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t\_0 \cdot t\_0\right)}}\right)
\end{array}
\end{array}
Derivation
  1. Initial program 65.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*65.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. Simplified65.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. Add Preprocessing
  5. Taylor expanded in phi2 around 0 52.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)} - \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right) \]
  6. Step-by-step derivation
    1. unpow252.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) - \left(\cos \phi_1 \cdot \cos \phi_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) \]
    2. 1-sub-sin52.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_1\right) \cdot \cos \left(0.5 \cdot \phi_1\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) \]
    3. unpow252.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
  7. Simplified52.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_1\right)}^{2}} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
  8. Taylor expanded in lambda2 around 0 38.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(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + -0.5 \cdot \left(\lambda_2 \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
  9. Step-by-step derivation
    1. associate-*r*38.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(\left(\sin \left(0.5 \cdot \lambda_1\right) + \color{blue}{\left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)}\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
  10. Simplified38.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(\color{blue}{\left(\sin \left(0.5 \cdot \lambda_1\right) + \left(-0.5 \cdot \lambda_2\right) \cdot \cos \left(0.5 \cdot \lambda_1\right)\right)} \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{{\cos \left(0.5 \cdot \phi_1\right)}^{2} - \left(\cos \phi_1 \cdot \cos \phi_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) \]
  11. Taylor expanded in lambda2 around 0 40.1%

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

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

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

Reproduce

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