Average Error: 23.8 → 13.6
Time: 1.2min
Precision: binary64
\[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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) \]
\[\begin{array}{l} t_0 := \sin \left(\phi_2 \cdot 0.5\right)\\ t_1 := \sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)\\ t_2 := \cos \left(\phi_1 \cdot 0.5\right)\\ t_3 := {t_2}^{2}\\ t_4 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_5 := \sin \left(\phi_1 \cdot 0.5\right)\\ t_6 := \cos \left(\phi_2 \cdot 0.5\right)\\ t_7 := {t_6}^{2}\\ t_8 := {t_1}^{2}\\ t_9 := {t_0}^{2}\\ t_10 := {\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_4 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_4\right)\\ t_11 := {t_5}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_10}}{\sqrt{\frac{\mathsf{fma}\left(4, t_2 \cdot \left(\cos \phi_2 \cdot \left(t_5 \cdot \left(t_6 \cdot \left(\cos \phi_1 \cdot \left(t_0 \cdot t_8\right)\right)\right)\right)\right), 1 + 4 \cdot \left(t_2 \cdot \left(\left(t_0 \cdot {t_6}^{3}\right) \cdot {t_5}^{3}\right) + {t_2}^{3} \cdot \left(t_5 \cdot \left(t_6 \cdot {t_0}^{3}\right)\right)\right)\right) - \mathsf{fma}\left({t_5}^{4}, {t_6}^{4}, \mathsf{fma}\left({t_2}^{4}, {t_0}^{4}, \mathsf{fma}\left(2, t_3 \cdot \left(\cos \phi_2 \cdot \left(\cos \phi_1 \cdot \left(t_8 \cdot t_9\right)\right)\right), \mathsf{fma}\left(6, t_3 \cdot \left(\left(t_9 \cdot t_7\right) \cdot t_11\right), \mathsf{fma}\left(2, \cos \phi_2 \cdot \left(t_11 \cdot \left(t_7 \cdot \left(\cos \phi_1 \cdot t_8\right)\right)\right), {\cos \phi_2}^{2} \cdot \left({\cos \phi_1}^{2} \cdot {t_1}^{4}\right)\right)\right)\right)\right)\right)}{t_10 + 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)) (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))))))))))
(FPCore (R lambda1 lambda2 phi1 phi2)
 :precision binary64
 (let* ((t_0 (sin (* phi2 0.5)))
        (t_1 (sin (* -0.5 (- lambda2 lambda1))))
        (t_2 (cos (* phi1 0.5)))
        (t_3 (pow t_2 2.0))
        (t_4 (sin (/ (- lambda1 lambda2) 2.0)))
        (t_5 (sin (* phi1 0.5)))
        (t_6 (cos (* phi2 0.5)))
        (t_7 (pow t_6 2.0))
        (t_8 (pow t_1 2.0))
        (t_9 (pow t_0 2.0))
        (t_10
         (+
          (pow
           (-
            (* (sin (/ phi1 2.0)) (cos (/ phi2 2.0)))
            (* (cos (/ phi1 2.0)) (sin (/ phi2 2.0))))
           2.0)
          (* t_4 (* (* (cos phi1) (cos phi2)) t_4))))
        (t_11 (pow t_5 2.0)))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt t_10)
      (sqrt
       (/
        (-
         (fma
          4.0
          (* t_2 (* (cos phi2) (* t_5 (* t_6 (* (cos phi1) (* t_0 t_8))))))
          (+
           1.0
           (*
            4.0
            (+
             (* t_2 (* (* t_0 (pow t_6 3.0)) (pow t_5 3.0)))
             (* (pow t_2 3.0) (* t_5 (* t_6 (pow t_0 3.0))))))))
         (fma
          (pow t_5 4.0)
          (pow t_6 4.0)
          (fma
           (pow t_2 4.0)
           (pow t_0 4.0)
           (fma
            2.0
            (* t_3 (* (cos phi2) (* (cos phi1) (* t_8 t_9))))
            (fma
             6.0
             (* t_3 (* (* t_9 t_7) t_11))
             (fma
              2.0
              (* (cos phi2) (* t_11 (* t_7 (* (cos phi1) t_8))))
              (*
               (pow (cos phi2) 2.0)
               (* (pow (cos phi1) 2.0) (pow t_1 4.0)))))))))
        (+ t_10 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)) * 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))))))));
}
double code(double R, double lambda1, double lambda2, double phi1, double phi2) {
	double t_0 = sin((phi2 * 0.5));
	double t_1 = sin((-0.5 * (lambda2 - lambda1)));
	double t_2 = cos((phi1 * 0.5));
	double t_3 = pow(t_2, 2.0);
	double t_4 = sin(((lambda1 - lambda2) / 2.0));
	double t_5 = sin((phi1 * 0.5));
	double t_6 = cos((phi2 * 0.5));
	double t_7 = pow(t_6, 2.0);
	double t_8 = pow(t_1, 2.0);
	double t_9 = pow(t_0, 2.0);
	double t_10 = pow(((sin((phi1 / 2.0)) * cos((phi2 / 2.0))) - (cos((phi1 / 2.0)) * sin((phi2 / 2.0)))), 2.0) + (t_4 * ((cos(phi1) * cos(phi2)) * t_4));
	double t_11 = pow(t_5, 2.0);
	return R * (2.0 * atan2(sqrt(t_10), sqrt(((fma(4.0, (t_2 * (cos(phi2) * (t_5 * (t_6 * (cos(phi1) * (t_0 * t_8)))))), (1.0 + (4.0 * ((t_2 * ((t_0 * pow(t_6, 3.0)) * pow(t_5, 3.0))) + (pow(t_2, 3.0) * (t_5 * (t_6 * pow(t_0, 3.0)))))))) - fma(pow(t_5, 4.0), pow(t_6, 4.0), fma(pow(t_2, 4.0), pow(t_0, 4.0), fma(2.0, (t_3 * (cos(phi2) * (cos(phi1) * (t_8 * t_9)))), fma(6.0, (t_3 * ((t_9 * t_7) * t_11)), fma(2.0, (cos(phi2) * (t_11 * (t_7 * (cos(phi1) * t_8)))), (pow(cos(phi2), 2.0) * (pow(cos(phi1), 2.0) * pow(t_1, 4.0))))))))) / (t_10 + 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(Float64(cos(phi1) * cos(phi2)) * sin(Float64(Float64(lambda1 - lambda2) / 2.0))) * sin(Float64(Float64(lambda1 - lambda2) / 2.0))))), sqrt(Float64(1.0 - Float64((sin(Float64(Float64(phi1 - phi2) / 2.0)) ^ 2.0) + Float64(Float64(Float64(cos(phi1) * cos(phi2)) * sin(Float64(Float64(lambda1 - lambda2) / 2.0))) * sin(Float64(Float64(lambda1 - lambda2) / 2.0)))))))))
end
function code(R, lambda1, lambda2, phi1, phi2)
	t_0 = sin(Float64(phi2 * 0.5))
	t_1 = sin(Float64(-0.5 * Float64(lambda2 - lambda1)))
	t_2 = cos(Float64(phi1 * 0.5))
	t_3 = t_2 ^ 2.0
	t_4 = sin(Float64(Float64(lambda1 - lambda2) / 2.0))
	t_5 = sin(Float64(phi1 * 0.5))
	t_6 = cos(Float64(phi2 * 0.5))
	t_7 = t_6 ^ 2.0
	t_8 = t_1 ^ 2.0
	t_9 = t_0 ^ 2.0
	t_10 = 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_4 * Float64(Float64(cos(phi1) * cos(phi2)) * t_4)))
	t_11 = t_5 ^ 2.0
	return Float64(R * Float64(2.0 * atan(sqrt(t_10), sqrt(Float64(Float64(fma(4.0, Float64(t_2 * Float64(cos(phi2) * Float64(t_5 * Float64(t_6 * Float64(cos(phi1) * Float64(t_0 * t_8)))))), Float64(1.0 + Float64(4.0 * Float64(Float64(t_2 * Float64(Float64(t_0 * (t_6 ^ 3.0)) * (t_5 ^ 3.0))) + Float64((t_2 ^ 3.0) * Float64(t_5 * Float64(t_6 * (t_0 ^ 3.0)))))))) - fma((t_5 ^ 4.0), (t_6 ^ 4.0), fma((t_2 ^ 4.0), (t_0 ^ 4.0), fma(2.0, Float64(t_3 * Float64(cos(phi2) * Float64(cos(phi1) * Float64(t_8 * t_9)))), fma(6.0, Float64(t_3 * Float64(Float64(t_9 * t_7) * t_11)), fma(2.0, Float64(cos(phi2) * Float64(t_11 * Float64(t_7 * Float64(cos(phi1) * t_8)))), Float64((cos(phi2) ^ 2.0) * Float64((cos(phi1) ^ 2.0) * (t_1 ^ 4.0))))))))) / Float64(t_10 + 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[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[(1.0 - 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] * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
code[R_, lambda1_, lambda2_, phi1_, phi2_] := Block[{t$95$0 = N[Sin[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Sin[N[(-0.5 * N[(lambda2 - lambda1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(phi1 * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[Power[t$95$2, 2.0], $MachinePrecision]}, Block[{t$95$4 = N[Sin[N[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$5 = N[Sin[N[(phi1 * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$6 = N[Cos[N[(phi2 * 0.5), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$7 = N[Power[t$95$6, 2.0], $MachinePrecision]}, Block[{t$95$8 = N[Power[t$95$1, 2.0], $MachinePrecision]}, Block[{t$95$9 = N[Power[t$95$0, 2.0], $MachinePrecision]}, Block[{t$95$10 = 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$4 * N[(N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision] * t$95$4), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$11 = N[Power[t$95$5, 2.0], $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[t$95$10], $MachinePrecision] / N[Sqrt[N[(N[(N[(4.0 * N[(t$95$2 * N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$5 * N[(t$95$6 * N[(N[Cos[phi1], $MachinePrecision] * N[(t$95$0 * t$95$8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(1.0 + N[(4.0 * N[(N[(t$95$2 * N[(N[(t$95$0 * N[Power[t$95$6, 3.0], $MachinePrecision]), $MachinePrecision] * N[Power[t$95$5, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[t$95$2, 3.0], $MachinePrecision] * N[(t$95$5 * N[(t$95$6 * N[Power[t$95$0, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[Power[t$95$5, 4.0], $MachinePrecision] * N[Power[t$95$6, 4.0], $MachinePrecision] + N[(N[Power[t$95$2, 4.0], $MachinePrecision] * N[Power[t$95$0, 4.0], $MachinePrecision] + N[(2.0 * N[(t$95$3 * N[(N[Cos[phi2], $MachinePrecision] * N[(N[Cos[phi1], $MachinePrecision] * N[(t$95$8 * t$95$9), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(6.0 * N[(t$95$3 * N[(N[(t$95$9 * t$95$7), $MachinePrecision] * t$95$11), $MachinePrecision]), $MachinePrecision] + N[(2.0 * N[(N[Cos[phi2], $MachinePrecision] * N[(t$95$11 * N[(t$95$7 * N[(N[Cos[phi1], $MachinePrecision] * t$95$8), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Power[N[Cos[phi2], $MachinePrecision], 2.0], $MachinePrecision] * N[(N[Power[N[Cos[phi1], $MachinePrecision], 2.0], $MachinePrecision] * N[Power[t$95$1, 4.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(t$95$10 + 1.0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]]]]]]]]]
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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)
\begin{array}{l}
t_0 := \sin \left(\phi_2 \cdot 0.5\right)\\
t_1 := \sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)\\
t_2 := \cos \left(\phi_1 \cdot 0.5\right)\\
t_3 := {t_2}^{2}\\
t_4 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_5 := \sin \left(\phi_1 \cdot 0.5\right)\\
t_6 := \cos \left(\phi_2 \cdot 0.5\right)\\
t_7 := {t_6}^{2}\\
t_8 := {t_1}^{2}\\
t_9 := {t_0}^{2}\\
t_10 := {\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_4 \cdot \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot t_4\right)\\
t_11 := {t_5}^{2}\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_10}}{\sqrt{\frac{\mathsf{fma}\left(4, t_2 \cdot \left(\cos \phi_2 \cdot \left(t_5 \cdot \left(t_6 \cdot \left(\cos \phi_1 \cdot \left(t_0 \cdot t_8\right)\right)\right)\right)\right), 1 + 4 \cdot \left(t_2 \cdot \left(\left(t_0 \cdot {t_6}^{3}\right) \cdot {t_5}^{3}\right) + {t_2}^{3} \cdot \left(t_5 \cdot \left(t_6 \cdot {t_0}^{3}\right)\right)\right)\right) - \mathsf{fma}\left({t_5}^{4}, {t_6}^{4}, \mathsf{fma}\left({t_2}^{4}, {t_0}^{4}, \mathsf{fma}\left(2, t_3 \cdot \left(\cos \phi_2 \cdot \left(\cos \phi_1 \cdot \left(t_8 \cdot t_9\right)\right)\right), \mathsf{fma}\left(6, t_3 \cdot \left(\left(t_9 \cdot t_7\right) \cdot t_11\right), \mathsf{fma}\left(2, \cos \phi_2 \cdot \left(t_11 \cdot \left(t_7 \cdot \left(\cos \phi_1 \cdot t_8\right)\right)\right), {\cos \phi_2}^{2} \cdot \left({\cos \phi_1}^{2} \cdot {t_1}^{4}\right)\right)\right)\right)\right)\right)}{t_10 + 1}}}\right)
\end{array}

Error

Bits error versus R

Bits error versus lambda1

Bits error versus lambda2

Bits error versus phi1

Bits error versus phi2

Derivation

  1. Initial program 23.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. Applied div-sub_binary6423.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) \]
  3. Applied sin-diff_binary6423.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 div-sub_binary6423.2

    \[\leadsto R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\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)}}{\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) \]
  5. Applied sin-diff_binary6413.6

    \[\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) \]
  6. Applied flip--_binary6413.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{\color{blue}{\frac{1 \cdot 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) \cdot \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)}{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 -inf 13.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{\frac{\color{blue}{\left(4 \cdot \left(\cos \left(0.5 \cdot \phi_1\right) \cdot \left(\cos \phi_2 \cdot \left(\sin \left(0.5 \cdot \phi_1\right) \cdot \left(\cos \left(0.5 \cdot \phi_2\right) \cdot \left(\cos \phi_1 \cdot \left(\sin \left(0.5 \cdot \phi_2\right) \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}\right)\right)\right)\right)\right)\right) + \left(1 + \left(4 \cdot \left(\cos \left(0.5 \cdot \phi_1\right) \cdot \left({\sin \left(0.5 \cdot \phi_1\right)}^{3} \cdot \left({\cos \left(0.5 \cdot \phi_2\right)}^{3} \cdot \sin \left(0.5 \cdot \phi_2\right)\right)\right)\right) + 4 \cdot \left({\cos \left(0.5 \cdot \phi_1\right)}^{3} \cdot \left(\sin \left(0.5 \cdot \phi_1\right) \cdot \left(\cos \left(0.5 \cdot \phi_2\right) \cdot {\sin \left(0.5 \cdot \phi_2\right)}^{3}\right)\right)\right)\right)\right)\right) - \left({\sin \left(0.5 \cdot \phi_1\right)}^{4} \cdot {\cos \left(0.5 \cdot \phi_2\right)}^{4} + \left({\cos \left(0.5 \cdot \phi_1\right)}^{4} \cdot {\sin \left(0.5 \cdot \phi_2\right)}^{4} + \left(2 \cdot \left({\cos \left(0.5 \cdot \phi_1\right)}^{2} \cdot \left(\cos \phi_2 \cdot \left(\cos \phi_1 \cdot \left({\sin \left(0.5 \cdot \phi_2\right)}^{2} \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}\right)\right)\right)\right) + \left(6 \cdot \left({\cos \left(0.5 \cdot \phi_1\right)}^{2} \cdot \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} \cdot \left({\cos \left(0.5 \cdot \phi_2\right)}^{2} \cdot {\sin \left(0.5 \cdot \phi_2\right)}^{2}\right)\right)\right) + \left(2 \cdot \left(\cos \phi_2 \cdot \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} \cdot \left({\cos \left(0.5 \cdot \phi_2\right)}^{2} \cdot \left(\cos \phi_1 \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}\right)\right)\right)\right) + {\cos \phi_2}^{2} \cdot \left({\cos \phi_1}^{2} \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{4}\right)\right)\right)\right)\right)\right)}}{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) \]
  8. Simplified13.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{\frac{\color{blue}{\mathsf{fma}\left(4, \cos \left(0.5 \cdot \phi_1\right) \cdot \left(\cos \phi_2 \cdot \left(\sin \left(0.5 \cdot \phi_1\right) \cdot \left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \left(\cos \phi_1 \cdot \left(\sin \left(\phi_2 \cdot 0.5\right) \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}\right)\right)\right)\right)\right), 1 + 4 \cdot \left(\cos \left(0.5 \cdot \phi_1\right) \cdot \left(\left(\sin \left(\phi_2 \cdot 0.5\right) \cdot {\cos \left(\phi_2 \cdot 0.5\right)}^{3}\right) \cdot {\sin \left(0.5 \cdot \phi_1\right)}^{3}\right) + {\cos \left(0.5 \cdot \phi_1\right)}^{3} \cdot \left(\left(\cos \left(\phi_2 \cdot 0.5\right) \cdot {\sin \left(\phi_2 \cdot 0.5\right)}^{3}\right) \cdot \sin \left(0.5 \cdot \phi_1\right)\right)\right)\right) - \mathsf{fma}\left({\sin \left(0.5 \cdot \phi_1\right)}^{4}, {\cos \left(\phi_2 \cdot 0.5\right)}^{4}, \mathsf{fma}\left({\cos \left(0.5 \cdot \phi_1\right)}^{4}, {\sin \left(\phi_2 \cdot 0.5\right)}^{4}, \mathsf{fma}\left(2, {\cos \left(0.5 \cdot \phi_1\right)}^{2} \cdot \left(\cos \phi_2 \cdot \left(\cos \phi_1 \cdot \left({\sin \left(\phi_2 \cdot 0.5\right)}^{2} \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}\right)\right)\right), \mathsf{fma}\left(6, {\cos \left(0.5 \cdot \phi_1\right)}^{2} \cdot \left(\left({\sin \left(\phi_2 \cdot 0.5\right)}^{2} \cdot {\cos \left(\phi_2 \cdot 0.5\right)}^{2}\right) \cdot {\sin \left(0.5 \cdot \phi_1\right)}^{2}\right), \mathsf{fma}\left(2, \cos \phi_2 \cdot \left({\sin \left(0.5 \cdot \phi_1\right)}^{2} \cdot \left({\cos \left(\phi_2 \cdot 0.5\right)}^{2} \cdot \left(\cos \phi_1 \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}\right)\right)\right), {\cos \phi_2}^{2} \cdot \left({\cos \phi_1}^{2} \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{4}\right)\right)\right)\right)\right)\right)}}{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) \]
  9. Final simplification13.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} + \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{\frac{\mathsf{fma}\left(4, \cos \left(\phi_1 \cdot 0.5\right) \cdot \left(\cos \phi_2 \cdot \left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \left(\cos \left(\phi_2 \cdot 0.5\right) \cdot \left(\cos \phi_1 \cdot \left(\sin \left(\phi_2 \cdot 0.5\right) \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}\right)\right)\right)\right)\right), 1 + 4 \cdot \left(\cos \left(\phi_1 \cdot 0.5\right) \cdot \left(\left(\sin \left(\phi_2 \cdot 0.5\right) \cdot {\cos \left(\phi_2 \cdot 0.5\right)}^{3}\right) \cdot {\sin \left(\phi_1 \cdot 0.5\right)}^{3}\right) + {\cos \left(\phi_1 \cdot 0.5\right)}^{3} \cdot \left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \left(\cos \left(\phi_2 \cdot 0.5\right) \cdot {\sin \left(\phi_2 \cdot 0.5\right)}^{3}\right)\right)\right)\right) - \mathsf{fma}\left({\sin \left(\phi_1 \cdot 0.5\right)}^{4}, {\cos \left(\phi_2 \cdot 0.5\right)}^{4}, \mathsf{fma}\left({\cos \left(\phi_1 \cdot 0.5\right)}^{4}, {\sin \left(\phi_2 \cdot 0.5\right)}^{4}, \mathsf{fma}\left(2, {\cos \left(\phi_1 \cdot 0.5\right)}^{2} \cdot \left(\cos \phi_2 \cdot \left(\cos \phi_1 \cdot \left({\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2} \cdot {\sin \left(\phi_2 \cdot 0.5\right)}^{2}\right)\right)\right), \mathsf{fma}\left(6, {\cos \left(\phi_1 \cdot 0.5\right)}^{2} \cdot \left(\left({\sin \left(\phi_2 \cdot 0.5\right)}^{2} \cdot {\cos \left(\phi_2 \cdot 0.5\right)}^{2}\right) \cdot {\sin \left(\phi_1 \cdot 0.5\right)}^{2}\right), \mathsf{fma}\left(2, \cos \phi_2 \cdot \left({\sin \left(\phi_1 \cdot 0.5\right)}^{2} \cdot \left({\cos \left(\phi_2 \cdot 0.5\right)}^{2} \cdot \left(\cos \phi_1 \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{2}\right)\right)\right), {\cos \phi_2}^{2} \cdot \left({\cos \phi_1}^{2} \cdot {\sin \left(-0.5 \cdot \left(\lambda_2 - \lambda_1\right)\right)}^{4}\right)\right)\right)\right)\right)\right)}{\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) + 1}}}\right) \]

Reproduce

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