Average Error: 0.2 → 0.2
Time: 19.1s
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 := \mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\sin delta \cdot \cos \phi_1\right)\right)\right)\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(\mathsf{log1p}\left(\log \left(1 + \mathsf{expm1}\left({t_1}^{3}\right)\right)\right) - \log \left(1 + \left({t_1}^{2} - t_1\right)\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
         (expm1
          (asin
           (fma
            (cos delta)
            (sin phi1)
            (* (cos theta) (* (sin delta) (cos phi1))))))))
   (+
    lambda1
    (atan2
     (* (sin delta) (* (cos phi1) (sin theta)))
     (fma
      (sin
       (log1p
        (expm1
         (-
          (log1p (log (+ 1.0 (expm1 (pow t_1 3.0)))))
          (log (+ 1.0 (- (pow t_1 2.0) t_1)))))))
      (- (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 = expm1(asin(fma(cos(delta), sin(phi1), (cos(theta) * (sin(delta) * cos(phi1))))));
	return lambda1 + atan2((sin(delta) * (cos(phi1) * sin(theta))), fma(sin(log1p(expm1((log1p(log((1.0 + expm1(pow(t_1, 3.0))))) - log((1.0 + (pow(t_1, 2.0) - t_1))))))), -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 = expm1(asin(fma(cos(delta), sin(phi1), Float64(cos(theta) * Float64(sin(delta) * cos(phi1))))))
	return Float64(lambda1 + atan(Float64(sin(delta) * Float64(cos(phi1) * sin(theta))), fma(sin(log1p(expm1(Float64(log1p(log(Float64(1.0 + expm1((t_1 ^ 3.0))))) - log(Float64(1.0 + Float64((t_1 ^ 2.0) - t_1))))))), 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[(Exp[N[ArcSin[N[(N[Cos[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision] + N[(N[Cos[theta], $MachinePrecision] * N[(N[Sin[delta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]] - 1), $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[Log[1 + N[Log[N[(1.0 + N[(Exp[N[Power[t$95$1, 3.0], $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision] - N[Log[N[(1.0 + N[(N[Power[t$95$1, 2.0], $MachinePrecision] - t$95$1), $MachinePrecision]), $MachinePrecision]], $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 := \mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\sin delta \cdot \cos \phi_1\right)\right)\right)\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(\mathsf{log1p}\left(\log \left(1 + \mathsf{expm1}\left({t_1}^{3}\right)\right)\right) - \log \left(1 + \left({t_1}^{2} - t_1\right)\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.2

    \[\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 delta, \sin \phi_1, \left(\cos theta \cdot \cos \phi_1\right) \cdot \sin delta\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}{\mathsf{log1p}\left({\left(\mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\cos \phi_1 \cdot \sin delta\right)\right)\right)\right)\right)}^{3}\right) - \log \left(1 + \left({\left(\mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\cos \phi_1 \cdot \sin delta\right)\right)\right)\right)\right)}^{2} - \mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\cos \phi_1 \cdot \sin delta\right)\right)\right)\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(\mathsf{log1p}\left(\color{blue}{\log \left(1 + \mathsf{expm1}\left({\left(\mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\cos \phi_1 \cdot \sin delta\right)\right)\right)\right)\right)}^{3}\right)\right)}\right) - \log \left(1 + \left({\left(\mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\cos \phi_1 \cdot \sin delta\right)\right)\right)\right)\right)}^{2} - \mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\cos \phi_1 \cdot \sin delta\right)\right)\right)\right)\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(\mathsf{log1p}\left(\log \left(1 + \mathsf{expm1}\left({\left(\mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\sin delta \cdot \cos \phi_1\right)\right)\right)\right)\right)}^{3}\right)\right)\right) - \log \left(1 + \left({\left(\mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\sin delta \cdot \cos \phi_1\right)\right)\right)\right)\right)}^{2} - \mathsf{expm1}\left(\sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \cos theta \cdot \left(\sin delta \cdot \cos \phi_1\right)\right)\right)\right)\right)\right)\right)\right)\right), -\sin \phi_1, \cos delta\right)} \]

Reproduce

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