Average Error: 0.2 → 0.2
Time: 26.6s
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 := \sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)\right)\\ t_2 := \sin \left(\sqrt[3]{t_1 \cdot \left(t_1 \cdot t_1\right)}\right)\\ t_3 := \sin \phi_1 \cdot t_2\\ \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(1, \cos delta, -t_3\right) + \mathsf{fma}\left(-t_2, \sin \phi_1, t_3\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
         (asin
          (fma
           (cos delta)
           (sin phi1)
           (* (* (sin delta) (cos phi1)) (cos theta)))))
        (t_2 (sin (cbrt (* t_1 (* t_1 t_1)))))
        (t_3 (* (sin phi1) t_2)))
   (+
    lambda1
    (atan2
     (* (* (sin theta) (sin delta)) (cos phi1))
     (+ (fma 1.0 (cos delta) (- t_3)) (fma (- t_2) (sin phi1) t_3))))))
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 = asin(fma(cos(delta), sin(phi1), ((sin(delta) * cos(phi1)) * cos(theta))));
	double t_2 = sin(cbrt((t_1 * (t_1 * t_1))));
	double t_3 = sin(phi1) * t_2;
	return lambda1 + atan2(((sin(theta) * sin(delta)) * cos(phi1)), (fma(1.0, cos(delta), -t_3) + fma(-t_2, sin(phi1), t_3)));
}
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 = asin(fma(cos(delta), sin(phi1), Float64(Float64(sin(delta) * cos(phi1)) * cos(theta))))
	t_2 = sin(cbrt(Float64(t_1 * Float64(t_1 * t_1))))
	t_3 = Float64(sin(phi1) * t_2)
	return Float64(lambda1 + atan(Float64(Float64(sin(theta) * sin(delta)) * cos(phi1)), Float64(fma(1.0, cos(delta), Float64(-t_3)) + fma(Float64(-t_2), sin(phi1), t_3))))
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[ArcSin[N[(N[Cos[delta], $MachinePrecision] * N[Sin[phi1], $MachinePrecision] + N[(N[(N[Sin[delta], $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] * N[Cos[theta], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Sin[N[Power[N[(t$95$1 * N[(t$95$1 * t$95$1), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Sin[phi1], $MachinePrecision] * t$95$2), $MachinePrecision]}, N[(lambda1 + N[ArcTan[N[(N[(N[Sin[theta], $MachinePrecision] * N[Sin[delta], $MachinePrecision]), $MachinePrecision] * N[Cos[phi1], $MachinePrecision]), $MachinePrecision] / N[(N[(1.0 * N[Cos[delta], $MachinePrecision] + (-t$95$3)), $MachinePrecision] + N[((-t$95$2) * N[Sin[phi1], $MachinePrecision] + t$95$3), $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 := \sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)\right)\\
t_2 := \sin \left(\sqrt[3]{t_1 \cdot \left(t_1 \cdot t_1\right)}\right)\\
t_3 := \sin \phi_1 \cdot t_2\\
\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\mathsf{fma}\left(1, \cos delta, -t_3\right) + \mathsf{fma}\left(-t_2, \sin \phi_1, t_3\right)}
\end{array}

Error

Bits error versus lambda1

Bits error versus phi1

Bits error versus phi2

Bits error versus delta

Bits error versus theta

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}{\cos delta - \sin \phi_1 \cdot \sin \sin^{-1} \left(\mathsf{fma}\left(\cos delta, \sin \phi_1, \left(\sin delta \cdot \cos \phi_1\right) \cdot \cos theta\right)\right)}} \]
  3. Applied add-cbrt-cube_binary640.2

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

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

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

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

Reproduce

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