Average Error: 0.2 → 0.2
Time: 16.5s
Precision: binary64
\[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
\[\begin{array}{l} t_1 := \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)\\ t_2 := {\left(\pi \cdot 0.5\right)}^{2} + t_1 \cdot \left(\pi \cdot 0.5 + t_1\right)\\ \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\mathsf{fma}\left(\sin \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{{\left(\pi \cdot 0.5\right)}^{3} - {t_1}^{3}}{\sqrt[3]{t_2 \cdot \left(t_2 \cdot t_2\right)}}\right)\right)\right), -\sin \phi_1, \cos delta\right)} \end{array} \]
(FPCore (lambda1 phi1 phi2 delta theta)
 :precision binary64
 (+
  lambda1
  (atan2
   (* (* (sin theta) (sin delta)) (cos phi1))
   (-
    (cos delta)
    (*
     (sin phi1)
     (sin
      (asin
       (+
        (* (sin phi1) (cos delta))
        (* (* (cos phi1) (sin delta)) (cos theta))))))))))
(FPCore (lambda1 phi1 phi2 delta theta)
 :precision binary64
 (let* ((t_1
         (acos
          (fma
           (cos theta)
           (* (sin delta) (cos phi1))
           (* (cos delta) (sin phi1)))))
        (t_2 (+ (pow (* PI 0.5) 2.0) (* t_1 (+ (* PI 0.5) t_1)))))
   (+
    lambda1
    (atan2
     (* (sin delta) (* (cos phi1) (sin theta)))
     (fma
      (sin
       (log1p
        (expm1
         (/
          (- (pow (* PI 0.5) 3.0) (pow t_1 3.0))
          (cbrt (* t_2 (* t_2 t_2)))))))
      (- (sin phi1))
      (cos delta))))))
double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	return lambda1 + atan2(((sin(theta) * sin(delta)) * cos(phi1)), (cos(delta) - (sin(phi1) * sin(asin(((sin(phi1) * cos(delta)) + ((cos(phi1) * sin(delta)) * cos(theta))))))));
}
double code(double lambda1, double phi1, double phi2, double delta, double theta) {
	double t_1 = acos(fma(cos(theta), (sin(delta) * cos(phi1)), (cos(delta) * sin(phi1))));
	double t_2 = pow((((double) M_PI) * 0.5), 2.0) + (t_1 * ((((double) M_PI) * 0.5) + t_1));
	return lambda1 + atan2((sin(delta) * (cos(phi1) * sin(theta))), fma(sin(log1p(expm1(((pow((((double) M_PI) * 0.5), 3.0) - pow(t_1, 3.0)) / cbrt((t_2 * (t_2 * t_2))))))), -sin(phi1), cos(delta)));
}
function code(lambda1, phi1, phi2, delta, theta)
	return Float64(lambda1 + atan(Float64(Float64(sin(theta) * sin(delta)) * cos(phi1)), Float64(cos(delta) - Float64(sin(phi1) * sin(asin(Float64(Float64(sin(phi1) * cos(delta)) + Float64(Float64(cos(phi1) * sin(delta)) * cos(theta)))))))))
end
function code(lambda1, phi1, phi2, delta, theta)
	t_1 = acos(fma(cos(theta), Float64(sin(delta) * cos(phi1)), Float64(cos(delta) * sin(phi1))))
	t_2 = Float64((Float64(pi * 0.5) ^ 2.0) + Float64(t_1 * Float64(Float64(pi * 0.5) + t_1)))
	return Float64(lambda1 + atan(Float64(sin(delta) * Float64(cos(phi1) * sin(theta))), fma(sin(log1p(expm1(Float64(Float64((Float64(pi * 0.5) ^ 3.0) - (t_1 ^ 3.0)) / cbrt(Float64(t_2 * Float64(t_2 * t_2))))))), Float64(-sin(phi1)), cos(delta))))
end
code[lambda1_, phi1_, phi2_, delta_, theta_] := N[(lambda1 + N[ArcTan[N[(N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] / N[(N[Cos[delta], $MachinePrecision] - N[(N[Sin[phi1], $MachinePrecision] * N[Sin[N[ArcSin[N[(N[(N[Sin[phi1], $MachinePrecision] * N[Cos[delta], $MachinePrecision]), $MachinePrecision] + N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] * N[Cos[theta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[lambda1_, phi1_, phi2_, delta_, theta_] := Block[{t$95$1 = N[ArcCos[N[(N[Cos[theta], $MachinePrecision] * N[(N[Sin[delta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] + N[(N[Cos[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[(Pi * 0.5), $MachinePrecision], 2.0], $MachinePrecision] + N[(t$95$1 * N[(N[(Pi * 0.5), $MachinePrecision] + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]}, N[(lambda1 + N[ArcTan[N[(N[Sin[delta], $MachinePrecision] * N[(N[Cos[phi1], $MachinePrecision] * N[Sin[theta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(N[Sin[N[Log[1 + N[(Exp[N[(N[(N[Power[N[(Pi * 0.5), $MachinePrecision], 3.0], $MachinePrecision] - N[Power[t$95$1, 3.0], $MachinePrecision]), $MachinePrecision] / N[Power[N[(t$95$2 * N[(t$95$2 * t$95$2), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] * (-N[Sin[phi1], $MachinePrecision]) + N[Cos[delta], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)}
\begin{array}{l}
t_1 := \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)\\
t_2 := {\left(\pi \cdot 0.5\right)}^{2} + t_1 \cdot \left(\pi \cdot 0.5 + t_1\right)\\
\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\mathsf{fma}\left(\sin \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{{\left(\pi \cdot 0.5\right)}^{3} - {t_1}^{3}}{\sqrt[3]{t_2 \cdot \left(t_2 \cdot t_2\right)}}\right)\right)\right), -\sin \phi_1, \cos delta\right)}
\end{array}

Error

Derivation

  1. Initial program 0.2

    \[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)} \]
  2. Simplified0.1

    \[\leadsto \color{blue}{\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\mathsf{fma}\left(\sin \sin^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right), -\sin \phi_1, \cos delta\right)}} \]
  3. Applied egg-rr0.2

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\mathsf{fma}\left(\sin \color{blue}{\left(\mathsf{log1p}\left(\mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)\right)\right)\right)}, -\sin \phi_1, \cos delta\right)} \]
  4. Applied egg-rr0.2

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\mathsf{fma}\left(\sin \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\color{blue}{\frac{{\left(\pi \cdot 0.5\right)}^{3} - {\cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)}^{3}}{\left(\pi \cdot 0.5\right) \cdot \left(\pi \cdot 0.5\right) + \left(\cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) \cdot \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) + \left(\pi \cdot 0.5\right) \cdot \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)\right)}}\right)\right)\right), -\sin \phi_1, \cos delta\right)} \]
  5. Applied egg-rr0.2

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\mathsf{fma}\left(\sin \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{{\left(\pi \cdot 0.5\right)}^{3} - {\cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)}^{3}}{\color{blue}{\sqrt[3]{\left(\left({\left(\pi \cdot 0.5\right)}^{2} + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) \cdot \left(\cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) + \pi \cdot 0.5\right)\right) \cdot \left({\left(\pi \cdot 0.5\right)}^{2} + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) \cdot \left(\cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) + \pi \cdot 0.5\right)\right)\right) \cdot \left({\left(\pi \cdot 0.5\right)}^{2} + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) \cdot \left(\cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) + \pi \cdot 0.5\right)\right)}}}\right)\right)\right), -\sin \phi_1, \cos delta\right)} \]
  6. Final simplification0.2

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\mathsf{fma}\left(\sin \left(\mathsf{log1p}\left(\mathsf{expm1}\left(\frac{{\left(\pi \cdot 0.5\right)}^{3} - {\cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)}^{3}}{\sqrt[3]{\left({\left(\pi \cdot 0.5\right)}^{2} + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) \cdot \left(\pi \cdot 0.5 + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)\right)\right) \cdot \left(\left({\left(\pi \cdot 0.5\right)}^{2} + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) \cdot \left(\pi \cdot 0.5 + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)\right)\right) \cdot \left({\left(\pi \cdot 0.5\right)}^{2} + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right) \cdot \left(\pi \cdot 0.5 + \cos^{-1} \left(\mathsf{fma}\left(\cos theta, \sin delta \cdot \cos \phi_1, \cos delta \cdot \sin \phi_1\right)\right)\right)\right)\right)}}\right)\right)\right), -\sin \phi_1, \cos delta\right)} \]

Reproduce

herbie shell --seed 2022212 
(FPCore (lambda1 phi1 phi2 delta theta)
  :name "Destination given bearing on a great circle"
  :precision binary64
  (+ lambda1 (atan2 (* (* (sin theta) (sin delta)) (cos phi1)) (- (cos delta) (* (sin phi1) (sin (asin (+ (* (sin phi1) (cos delta)) (* (* (cos phi1) (sin delta)) (cos theta))))))))))