Average Error: 0.2 → 0.2
Time: 39.9s
Precision: binary64
Cost: 97088
\[\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)} \]
\[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\sin \sin^{-1} \left(\mathsf{fma}\left(\sin \phi_1, \cos delta, \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right), -\sin \phi_1, \cos delta\right)} \]
(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
 (+
  lambda1
  (atan2
   (* (* (sin theta) (sin delta)) (cos phi1))
   (fma
    (sin
     (asin
      (fma (sin phi1) (cos delta) (* (* (cos phi1) (sin delta)) (cos theta)))))
    (- (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) {
	return lambda1 + atan2(((sin(theta) * sin(delta)) * cos(phi1)), fma(sin(asin(fma(sin(phi1), cos(delta), ((cos(phi1) * sin(delta)) * cos(theta))))), -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)
	return Float64(lambda1 + atan(Float64(Float64(sin(theta) * sin(delta)) * cos(phi1)), fma(sin(asin(fma(sin(phi1), cos(delta), Float64(Float64(cos(phi1) * sin(delta)) * cos(theta))))), 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_] := N[(lambda1 + N[ArcTan[N[(N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] / N[(N[Sin[N[ArcSin[N[(N[Sin[phi1], $MachinePrecision] * N[Cos[delta], $MachinePrecision] + N[(N[(N[Cos[phi1], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] * N[Cos[theta], $MachinePrecision]), $MachinePrecision]), $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)}
\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\sin \sin^{-1} \left(\mathsf{fma}\left(\sin \phi_1, \cos delta, \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right), -\sin \phi_1, \cos delta\right)}

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{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(\sin \sin^{-1} \left(\mathsf{fma}\left(\sin \phi_1, \cos delta, \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right), -\sin \phi_1, \cos delta\right)}} \]
    Proof

Alternatives

Alternative 1
Error0.2
Cost97088
\[\lambda_1 + \tan^{-1}_* \frac{\left(\sin delta \cdot \cos \phi_1\right) \cdot \sin theta}{\mathsf{fma}\left(\sin \sin^{-1} \left(\mathsf{fma}\left(\sin \phi_1, \cos delta, \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right)\right), -\sin \phi_1, \cos delta\right)} \]
Alternative 2
Error0.2
Cost90752
\[\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \left(\cos \phi_1 \cdot \sin theta\right)}{\cos delta - \sin \sin^{-1} \left(\mathsf{fma}\left(\sin delta \cdot \cos theta, \cos \phi_1, \sin \phi_1 \cdot \cos delta\right)\right) \cdot \sin \phi_1} \]
Alternative 3
Error0.2
Cost90752
\[\lambda_1 + \tan^{-1}_* \frac{\left(\sin delta \cdot \cos \phi_1\right) \cdot \sin theta}{\cos delta - \sin \sin^{-1} \left(\mathsf{fma}\left(\sin delta \cdot \cos theta, \cos \phi_1, \sin \phi_1 \cdot \cos delta\right)\right) \cdot \sin \phi_1} \]
Alternative 4
Error5.5
Cost84616
\[\begin{array}{l} t_1 := \sqrt[3]{\cos \phi_1}\\ t_2 := \lambda_1 + \tan^{-1}_* \frac{\left(\left(\left(\sin theta \cdot \sin delta\right) \cdot t_1\right) \cdot t_1\right) \cdot t_1}{\cos delta}\\ \mathbf{if}\;theta \leq -6.6 \cdot 10^{+24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;theta \leq 2 \cdot 10^{-33}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\left(\sin delta \cdot theta\right) \cdot \cos \phi_1}{\cos delta - \sin \sin^{-1} \left(\mathsf{fma}\left(\sin \phi_1, \cos delta, \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right) \cdot \sin \phi_1}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 5
Error0.2
Cost84480
\[\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(\cos delta \cdot \sin \phi_1 + \sin delta \cdot \left(\cos \phi_1 \cdot \cos theta\right)\right)} \]
Alternative 6
Error5.5
Cost78344
\[\begin{array}{l} t_1 := \sqrt[3]{\cos \phi_1}\\ t_2 := \lambda_1 + \tan^{-1}_* \frac{\left(\left(\left(\sin theta \cdot \sin delta\right) \cdot t_1\right) \cdot t_1\right) \cdot t_1}{\cos delta}\\ \mathbf{if}\;theta \leq -6.6 \cdot 10^{+24}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;theta \leq 1.7 \cdot 10^{-27}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\left(\sin delta \cdot theta\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)}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array} \]
Alternative 7
Error7.4
Cost64768
\[\begin{array}{l} t_1 := \sqrt[3]{\cos \phi_1}\\ \lambda_1 + \tan^{-1}_* \frac{\left(\left(\left(\sin theta \cdot \sin delta\right) \cdot t_1\right) \cdot t_1\right) \cdot t_1}{\cos delta} \end{array} \]
Alternative 8
Error7.4
Cost32512
\[\lambda_1 + \tan^{-1}_* \frac{\left(\sin delta \cdot \cos \phi_1\right) \cdot \sin theta}{\cos delta} \]
Alternative 9
Error8.9
Cost25984
\[\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot \sin theta}{\cos delta} \]
Alternative 10
Error15.4
Cost19848
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot theta}{\cos delta}\\ \mathbf{if}\;delta \leq -5.5:\\ \;\;\;\;t_1\\ \mathbf{elif}\;delta \leq 1.05 \cdot 10^{-133}:\\ \;\;\;\;\lambda_1\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error13.0
Cost19848
\[\begin{array}{l} t_1 := \lambda_1 + \tan^{-1}_* \frac{\sin theta \cdot delta}{\cos delta}\\ \mathbf{if}\;theta \leq -2.4 \cdot 10^{+29}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;theta \leq 3.2 \cdot 10^{-16}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{\sin delta \cdot theta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 12
Error19.4
Cost19720
\[\begin{array}{l} \mathbf{if}\;\lambda_1 \leq -1.1 \cdot 10^{-85}:\\ \;\;\;\;\lambda_1\\ \mathbf{elif}\;\lambda_1 \leq -8 \cdot 10^{-115}:\\ \;\;\;\;\tan^{-1}_* \frac{\sin delta \cdot theta}{\cos delta}\\ \mathbf{elif}\;\lambda_1 \leq 2.3 \cdot 10^{-156}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot delta}{\cos delta}\\ \mathbf{else}:\\ \;\;\;\;\lambda_1\\ \end{array} \]
Alternative 13
Error20.1
Cost13316
\[\begin{array}{l} \mathbf{if}\;\phi_1 \leq -2.5 \cdot 10^{+20}:\\ \;\;\;\;\lambda_1\\ \mathbf{else}:\\ \;\;\;\;\lambda_1 + \tan^{-1}_* \frac{theta \cdot delta}{\cos delta}\\ \end{array} \]
Alternative 14
Error19.0
Cost64
\[\lambda_1 \]

Error

Reproduce

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