?

Average Accuracy: 62.2% → 78.8%
Time: 2.0min
Precision: binary64
Cost: 177024

?

\[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \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(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\\ t_2 := \cos \phi_1 \cdot \cos \phi_2\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t_2, t_0 \cdot t_0, t_1\right)}}{\sqrt{\log \left(e^{1 - \mathsf{fma}\left(t_2, 0.5 + -0.5 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_1 \cdot \cos \lambda_2\right), t_1\right)}\right)}}\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 (/ (- lambda1 lambda2) 2.0)))
        (t_1
         (pow
          (-
           (* (sin (* phi1 0.5)) (cos (* phi2 0.5)))
           (* (cos (* phi1 0.5)) (sin (* phi2 0.5))))
          2.0))
        (t_2 (* (cos phi1) (cos phi2))))
   (*
    R
    (*
     2.0
     (atan2
      (sqrt (fma t_2 (* t_0 t_0) t_1))
      (sqrt
       (log
        (exp
         (-
          1.0
          (fma
           t_2
           (+
            0.5
            (*
             -0.5
             (+
              (* (sin lambda1) (sin lambda2))
              (* (cos lambda1) (cos lambda2)))))
           t_1))))))))))
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(((lambda1 - lambda2) / 2.0));
	double t_1 = pow(((sin((phi1 * 0.5)) * cos((phi2 * 0.5))) - (cos((phi1 * 0.5)) * sin((phi2 * 0.5)))), 2.0);
	double t_2 = cos(phi1) * cos(phi2);
	return R * (2.0 * atan2(sqrt(fma(t_2, (t_0 * t_0), t_1)), sqrt(log(exp((1.0 - fma(t_2, (0.5 + (-0.5 * ((sin(lambda1) * sin(lambda2)) + (cos(lambda1) * cos(lambda2))))), t_1)))))));
}
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(Float64(lambda1 - lambda2) / 2.0))
	t_1 = Float64(Float64(sin(Float64(phi1 * 0.5)) * cos(Float64(phi2 * 0.5))) - Float64(cos(Float64(phi1 * 0.5)) * sin(Float64(phi2 * 0.5)))) ^ 2.0
	t_2 = Float64(cos(phi1) * cos(phi2))
	return Float64(R * Float64(2.0 * atan(sqrt(fma(t_2, Float64(t_0 * t_0), t_1)), sqrt(log(exp(Float64(1.0 - fma(t_2, Float64(0.5 + Float64(-0.5 * Float64(Float64(sin(lambda1) * sin(lambda2)) + Float64(cos(lambda1) * cos(lambda2))))), t_1))))))))
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[(N[(lambda1 - lambda2), $MachinePrecision] / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(N[(N[Sin[N[(phi1 * 0.5), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(phi2 * 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$2 = N[(N[Cos[phi1], $MachinePrecision] * N[Cos[phi2], $MachinePrecision]), $MachinePrecision]}, N[(R * N[(2.0 * N[ArcTan[N[Sqrt[N[(t$95$2 * N[(t$95$0 * t$95$0), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision] / N[Sqrt[N[Log[N[Exp[N[(1.0 - N[(t$95$2 * N[(0.5 + N[(-0.5 * N[(N[(N[Sin[lambda1], $MachinePrecision] * N[Sin[lambda2], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[lambda1], $MachinePrecision] * N[Cos[lambda2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]], $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(\frac{\lambda_1 - \lambda_2}{2}\right)\\
t_1 := {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\\
t_2 := \cos \phi_1 \cdot \cos \phi_2\\
R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t_2, t_0 \cdot t_0, t_1\right)}}{\sqrt{\log \left(e^{1 - \mathsf{fma}\left(t_2, 0.5 + -0.5 \cdot \left(\sin \lambda_1 \cdot \sin \lambda_2 + \cos \lambda_1 \cdot \cos \lambda_2\right), t_1\right)}\right)}}\right)
\end{array}

Error?

Derivation?

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

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

    [Start]62.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) \]
  3. Applied egg-rr63.1%

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

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

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

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

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

Alternatives

Alternative 1
Accuracy78.2%
Cost157568
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\\ t_2 := \cos \phi_1 \cdot \cos \phi_2\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t_2, t_0 \cdot t_0, t_1\right)}}{\sqrt{\log \left(e^{1 - \mathsf{fma}\left(t_2, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), t_1\right)}\right)}}\right) \end{array} \]
Alternative 2
Accuracy78.1%
Cost138697
\[\begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\\ t_3 := \sqrt{\mathsf{fma}\left(t_0, t_1 \cdot t_1, t_2\right)}\\ \mathbf{if}\;\lambda_1 \leq -2.55 \cdot 10^{-5} \lor \neg \left(\lambda_1 \leq 0.00015\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_3}{\sqrt{1 - \left(t_2 + \cos \phi_2 \cdot \left(\cos \phi_1 \cdot \left(0.5 + -0.5 \cdot \cos \lambda_1\right)\right)\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_3}{\sqrt{1 + \left(t_0 \cdot \left(-0.5 - -0.5 \cdot \cos \left(-\lambda_2\right)\right) - t_2\right)}}\right)\\ \end{array} \]
Alternative 3
Accuracy72.5%
Cost138632
\[\begin{array}{l} t_0 := \cos \phi_1 \cdot \cos \phi_2\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := t_1 \cdot t_1\\ t_3 := {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\\ t_4 := \mathsf{fma}\left(t_0, t_2, t_3\right)\\ t_5 := \sqrt{t_4}\\ \mathbf{if}\;\lambda_2 \leq -2.3 \cdot 10^{-5}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_5}{\sqrt{1 - \mathsf{fma}\left(t_0, t_2, {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}\right)\\ \mathbf{elif}\;\lambda_2 \leq 2.25 \cdot 10^{+18}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_5}{\sqrt{1 - \left(t_3 + \cos \phi_2 \cdot \left(\cos \phi_1 \cdot \left(0.5 + -0.5 \cdot \cos \lambda_1\right)\right)\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 \cdot {\sin \left(\lambda_2 \cdot -0.5\right)}^{2} + {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}{\sqrt{1 - t_4}}\right)\\ \end{array} \]
Alternative 4
Accuracy78.2%
Cost138496
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(\cos \phi_1 \cdot \cos \phi_2, t_0 \cdot t_0, t_1\right)}}{\sqrt{1 - \left(\cos \phi_2 \cdot \left(\cos \phi_1 \cdot \left(0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) + t_1\right)}}\right) \end{array} \]
Alternative 5
Accuracy78.2%
Cost138496
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\\ t_2 := \cos \phi_1 \cdot \cos \phi_2\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t_2, t_0 \cdot t_0, t_1\right)}}{\sqrt{\left(1 + t_2 \cdot \left(-0.5 - -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) - t_1}}\right) \end{array} \]
Alternative 6
Accuracy63.2%
Cost137728
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \cos \phi_1 \cdot \cos \phi_2\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t_1, t_0 \cdot t_0, {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}{\sqrt{\mathsf{expm1}\left(\mathsf{log1p}\left(1 - \mathsf{fma}\left(t_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\right)\right)\right)}}\right) \end{array} \]
Alternative 7
Accuracy63.1%
Cost137728
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \cos \phi_1 \cdot \cos \phi_2\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t_1, t_0 \cdot t_0, {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}{\sqrt{\log \left(e^{1 - \mathsf{fma}\left(t_1, 0.5 + -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right), {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\right)}\right)}}\right) \end{array} \]
Alternative 8
Accuracy63.1%
Cost131584
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := t_0 \cdot t_0\\ t_2 := \cos \phi_1 \cdot \cos \phi_2\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{\mathsf{fma}\left(t_2, t_1, {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\right)}}{\sqrt{1 - \mathsf{fma}\left(t_2, t_1, {\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2}\right)}}\right) \end{array} \]
Alternative 9
Accuracy63.1%
Cost119040
\[\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{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t_1}}{\sqrt{1 - \left({\left(\sin \left(\phi_1 \cdot 0.5\right) \cdot \cos \left(\phi_2 \cdot 0.5\right) - \cos \left(\phi_1 \cdot 0.5\right) \cdot \sin \left(\phi_2 \cdot 0.5\right)\right)}^{2} + t_1\right)}}\right) \end{array} \]
Alternative 10
Accuracy62.1%
Cost105344
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_0 \cdot t_0\right)}}{\sqrt{\log \left(e^{1 + \left(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot \left(-0.5 - -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}\right)}}\right) \end{array} \]
Alternative 11
Accuracy62.2%
Cost92544
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_0 \cdot t_0\right)}}{\sqrt{1 + \left(\cos \phi_1 \cdot \left(\cos \phi_2 \cdot \left(-0.5 - -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right) - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}\right)}}\right) \end{array} \]
Alternative 12
Accuracy62.2%
Cost92544
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_0 \cdot t_0\right)}}{\sqrt{\left(1 + \cos \phi_1 \cdot \left(\cos \phi_2 \cdot \left(-0.5 - -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\right)\right)\right) - {\sin \left(0.5 \cdot \left(\phi_1 - \phi_2\right)\right)}^{2}}}\right) \end{array} \]
Alternative 13
Accuracy62.2%
Cost92488
\[\begin{array}{l} t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_1 := {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}\\ t_2 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_3 := \cos \phi_1 \cdot \cos \phi_2\\ t_4 := \sqrt{t_0 + t_3 \cdot \left(t_2 \cdot t_2\right)}\\ t_5 := \cos \phi_2 \cdot t_1\\ \mathbf{if}\;\phi_2 \leq -7.6 \cdot 10^{-5}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_4}{\sqrt{0.5 + \left(0.5 \cdot \cos \left(-\phi_2\right) - t_5\right)}}\right)\\ \mathbf{elif}\;\phi_2 \leq 5.6 \cdot 10^{+15}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_4}{\sqrt{0.5 + \left(0.5 \cdot \cos \left(2 \cdot \left(\phi_1 \cdot 0.5\right)\right) - \cos \phi_1 \cdot t_1\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_5 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{\sqrt{1 - \left(t_0 + t_2 \cdot \left(t_3 \cdot t_2\right)\right)}}\right)\\ \end{array} \]
Alternative 14
Accuracy62.7%
Cost92228
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}\\ t_2 := \cos \phi_1 \cdot t_1\\ t_3 := \cos \phi_1 \cdot \cos \phi_2\\ t_4 := {\sin \left(\phi_1 \cdot 0.5\right)}^{2}\\ t_5 := \sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + t_3 \cdot \left(t_0 \cdot t_0\right)}\\ \mathbf{if}\;\phi_1 \leq -0.00018:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 \cdot \left(t_3 \cdot t_0\right) + t_4}}{\sqrt{\left(1 - t_4\right) - t_2}}\right)\\ \mathbf{elif}\;\phi_1 \leq 7 \cdot 10^{-6}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_5}{\sqrt{0.5 + \left(0.5 \cdot \cos \left(-\phi_2\right) - \cos \phi_2 \cdot t_1\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_5}{\sqrt{0.5 \cdot \cos \left(2 \cdot \left(\phi_1 \cdot 0.5\right)\right) + \left(0.5 - t_2\right)}}\right)\\ \end{array} \]
Alternative 15
Accuracy62.2%
Cost86281
\[\begin{array}{l} t_0 := {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := \sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_1 \cdot t_1\right)}\\ \mathbf{if}\;\phi_2 \leq -4.6 \cdot 10^{-6} \lor \neg \left(\phi_2 \leq 5.6 \cdot 10^{+15}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_2}{\sqrt{0.5 + \left(0.5 \cdot \cos \left(-\phi_2\right) - \cos \phi_2 \cdot t_0\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_2}{\sqrt{0.5 + \left(0.5 \cdot \cos \left(2 \cdot \left(\phi_1 \cdot 0.5\right)\right) - \cos \phi_1 \cdot t_0\right)}}\right)\\ \end{array} \]
Alternative 16
Accuracy62.2%
Cost86089
\[\begin{array}{l} t_0 := {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}\\ t_1 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_2 := \sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_1 \cdot t_1\right)}\\ \mathbf{if}\;\phi_2 \leq -7.5 \cdot 10^{-7} \lor \neg \left(\phi_2 \leq 5.6 \cdot 10^{+15}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_2}{\sqrt{0.5 + \left(0.5 \cdot \cos \left(-\phi_2\right) - \cos \phi_2 \cdot t_0\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_2}{\sqrt{\left(0.5 + \cos \phi_1 \cdot 0.5\right) - \cos \phi_1 \cdot t_0}}\right)\\ \end{array} \]
Alternative 17
Accuracy48.8%
Cost85824
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_0 \cdot t_0\right)}}{\sqrt{0.5 + \left(0.5 \cdot \cos \left(-\phi_2\right) - \cos \phi_2 \cdot {\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{2}\right)}}\right) \end{array} \]
Alternative 18
Accuracy39.5%
Cost79752
\[\begin{array}{l} t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_1 := 0.5 - -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)\\ t_2 := \cos \phi_1 \cdot \cos \phi_2\\ t_3 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_4 := \sqrt{t_0 + t_2 \cdot \left(t_3 \cdot t_3\right)}\\ \mathbf{if}\;\lambda_1 - \lambda_2 \leq -20000:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + t_2 \cdot \left(t_3 \cdot \sqrt[3]{{\sin \left(\left(\lambda_1 - \lambda_2\right) \cdot 0.5\right)}^{3}}\right)}}{\sqrt{t_1}}\right)\\ \mathbf{elif}\;\lambda_1 - \lambda_2 \leq 0.0002:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_4}{\sqrt{{\cos \left(\phi_2 \cdot -0.5\right)}^{2} + -0.25 \cdot \left(\cos \phi_2 \cdot \left(\lambda_2 \cdot \lambda_2\right)\right)}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_4}{\sqrt{\log \left(e^{t_1}\right)}}\right)\\ \end{array} \]
Alternative 19
Accuracy35.2%
Cost78912
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_0 \cdot t_0\right)}}{\sqrt{0.5 + 0.5 \cdot \log \left(e^{\cos \left(\lambda_2 - \lambda_1\right)}\right)}}\right) \end{array} \]
Alternative 20
Accuracy34.6%
Cost66249
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_1 := \sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_0 \cdot t_0\right)}\\ \mathbf{if}\;\lambda_2 \leq -7.8 \cdot 10^{-5} \lor \neg \left(\lambda_2 \leq 1.15 \cdot 10^{+66}\right):\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_1}{\sqrt{0.5 + 0.5 \cdot \cos \lambda_2}}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{t_1}{\sqrt{0.5 + 0.5 \cdot \cos \lambda_1}}\right)\\ \end{array} \]
Alternative 21
Accuracy33.4%
Cost66248
\[\begin{array}{l} t_0 := {\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2}\\ t_1 := \sqrt{0.5 - -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)}\\ t_2 := \cos \phi_1 \cdot \cos \phi_2\\ t_3 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ t_4 := t_2 \cdot \left(t_3 \cdot t_3\right)\\ \mathbf{if}\;\phi_1 \leq -7.5 \cdot 10^{-42}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + t_2 \cdot \left(t_3 \cdot \sin \left(\lambda_2 \cdot -0.5\right)\right)}}{t_1}\right)\\ \mathbf{elif}\;\phi_1 \leq 2.8 \cdot 10^{-36}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_4 + {\sin \left(\phi_2 \cdot -0.5\right)}^{2}}}{t_1}\right)\\ \mathbf{else}:\\ \;\;\;\;R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{t_0 + t_4}}{\sqrt{0.5 + 0.5 \cdot \cos \lambda_2}}\right)\\ \end{array} \]
Alternative 22
Accuracy35.2%
Cost66112
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_0 \cdot t_0\right)}}{\sqrt{0.5 - -0.5 \cdot \cos \left(\lambda_1 - \lambda_2\right)}}\right) \end{array} \]
Alternative 23
Accuracy30.2%
Cost65984
\[\begin{array}{l} t_0 := \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\\ R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\sin \left(\frac{\phi_1 - \phi_2}{2}\right)}^{2} + \left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \left(t_0 \cdot t_0\right)}}{\sqrt{0.5 + 0.5 \cdot \cos \lambda_2}}\right) \end{array} \]

Error

Reproduce?

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