Average Error: 0.2 → 0.2
Time: 36.2s
Precision: 64
\[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \left(\sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right)}\]
\[\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{{\left(\cos delta\right)}^{2} - \mathsf{fma}\left({\left(\sin delta\right)}^{2}, {\left(\cos \phi_1\right)}^{2} \cdot \left({\left(\cos theta\right)}^{2} \cdot {\left(\sin \phi_1\right)}^{2}\right), \mathsf{fma}\left(2, \sin delta \cdot \left(\cos \phi_1 \cdot \left({\left(\sin \phi_1\right)}^{3} \cdot \left(\cos delta \cdot \cos theta\right)\right)\right), \left(\sqrt{{\left(\sin \phi_1\right)}^{4}} \cdot \sqrt{{\left(\sin \phi_1\right)}^{4}}\right) \cdot {\left(\cos delta\right)}^{2}\right)\right)}{\mathsf{fma}\left(\cos \phi_1 \cdot \left(\cos theta \cdot \sin \phi_1\right), \sin delta, \mathsf{fma}\left(\cos delta, {\left(\sin \phi_1\right)}^{2}, \cos delta\right)\right)}}\]
\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \sin \phi_1 \cdot \sin \left(\sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right)}
\lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\frac{{\left(\cos delta\right)}^{2} - \mathsf{fma}\left({\left(\sin delta\right)}^{2}, {\left(\cos \phi_1\right)}^{2} \cdot \left({\left(\cos theta\right)}^{2} \cdot {\left(\sin \phi_1\right)}^{2}\right), \mathsf{fma}\left(2, \sin delta \cdot \left(\cos \phi_1 \cdot \left({\left(\sin \phi_1\right)}^{3} \cdot \left(\cos delta \cdot \cos theta\right)\right)\right), \left(\sqrt{{\left(\sin \phi_1\right)}^{4}} \cdot \sqrt{{\left(\sin \phi_1\right)}^{4}}\right) \cdot {\left(\cos delta\right)}^{2}\right)\right)}{\mathsf{fma}\left(\cos \phi_1 \cdot \left(\cos theta \cdot \sin \phi_1\right), \sin delta, \mathsf{fma}\left(\cos delta, {\left(\sin \phi_1\right)}^{2}, \cos delta\right)\right)}}
double f(double lambda1, double phi1, double __attribute__((unused)) phi2, double delta, double theta) {
        double r61241 = lambda1;
        double r61242 = theta;
        double r61243 = sin(r61242);
        double r61244 = delta;
        double r61245 = sin(r61244);
        double r61246 = r61243 * r61245;
        double r61247 = phi1;
        double r61248 = cos(r61247);
        double r61249 = r61246 * r61248;
        double r61250 = cos(r61244);
        double r61251 = sin(r61247);
        double r61252 = r61251 * r61250;
        double r61253 = r61248 * r61245;
        double r61254 = cos(r61242);
        double r61255 = r61253 * r61254;
        double r61256 = r61252 + r61255;
        double r61257 = asin(r61256);
        double r61258 = sin(r61257);
        double r61259 = r61251 * r61258;
        double r61260 = r61250 - r61259;
        double r61261 = atan2(r61249, r61260);
        double r61262 = r61241 + r61261;
        return r61262;
}

double f(double lambda1, double phi1, double __attribute__((unused)) phi2, double delta, double theta) {
        double r61263 = lambda1;
        double r61264 = theta;
        double r61265 = sin(r61264);
        double r61266 = delta;
        double r61267 = sin(r61266);
        double r61268 = r61265 * r61267;
        double r61269 = phi1;
        double r61270 = cos(r61269);
        double r61271 = r61268 * r61270;
        double r61272 = cos(r61266);
        double r61273 = 2.0;
        double r61274 = pow(r61272, r61273);
        double r61275 = pow(r61267, r61273);
        double r61276 = pow(r61270, r61273);
        double r61277 = cos(r61264);
        double r61278 = pow(r61277, r61273);
        double r61279 = sin(r61269);
        double r61280 = pow(r61279, r61273);
        double r61281 = r61278 * r61280;
        double r61282 = r61276 * r61281;
        double r61283 = 3.0;
        double r61284 = pow(r61279, r61283);
        double r61285 = r61272 * r61277;
        double r61286 = r61284 * r61285;
        double r61287 = r61270 * r61286;
        double r61288 = r61267 * r61287;
        double r61289 = 4.0;
        double r61290 = pow(r61279, r61289);
        double r61291 = sqrt(r61290);
        double r61292 = r61291 * r61291;
        double r61293 = r61292 * r61274;
        double r61294 = fma(r61273, r61288, r61293);
        double r61295 = fma(r61275, r61282, r61294);
        double r61296 = r61274 - r61295;
        double r61297 = r61277 * r61279;
        double r61298 = r61270 * r61297;
        double r61299 = fma(r61272, r61280, r61272);
        double r61300 = fma(r61298, r61267, r61299);
        double r61301 = r61296 / r61300;
        double r61302 = atan2(r61271, r61301);
        double r61303 = r61263 + r61302;
        return r61303;
}

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 \left(\sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right)}\]
  2. Using strategy rm
  3. Applied add-log-exp0.2

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\cos delta - \color{blue}{\log \left(e^{\sin \phi_1 \cdot \sin \left(\sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right)}\right)}}\]
  4. Applied add-log-exp0.2

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\log \left(e^{\cos delta}\right)} - \log \left(e^{\sin \phi_1 \cdot \sin \left(\sin^{-1} \left(\sin \phi_1 \cdot \cos delta + \left(\cos \phi_1 \cdot \sin delta\right) \cdot \cos theta\right)\right)}\right)}\]
  5. Applied diff-log0.2

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

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\log \color{blue}{\left(e^{\cos delta - \sin \left(\sin^{-1} \left(\mathsf{fma}\left(\sin delta, \cos \phi_1 \cdot \cos theta, \sin \phi_1 \cdot \cos delta\right)\right)\right) \cdot \sin \phi_1}\right)}}\]
  7. Using strategy rm
  8. Applied flip--0.2

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

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

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\log \left(e^{\frac{\cos delta \cdot \cos delta - \left(\sin \left(\sin^{-1} \left(\mathsf{fma}\left(\sin delta, \cos \phi_1 \cdot \cos theta, \sin \phi_1 \cdot \cos delta\right)\right)\right) \cdot \sin \left(\sin^{-1} \left(\mathsf{fma}\left(\sin delta, \cos \phi_1 \cdot \cos theta, \sin \phi_1 \cdot \cos delta\right)\right)\right)\right) \cdot {\left(\sin \phi_1\right)}^{2}}{\color{blue}{\mathsf{fma}\left(\sin \left(\sin^{-1} \left(\mathsf{fma}\left(\sin delta, \cos \phi_1 \cdot \cos theta, \sin \phi_1 \cdot \cos delta\right)\right)\right), \sin \phi_1, \cos delta\right)}}}\right)}\]
  11. Taylor expanded around inf 0.2

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

    \[\leadsto \lambda_1 + \tan^{-1}_* \frac{\left(\sin theta \cdot \sin delta\right) \cdot \cos \phi_1}{\color{blue}{\frac{{\left(\cos delta\right)}^{2} - \mathsf{fma}\left({\left(\sin delta\right)}^{2}, {\left(\cos \phi_1\right)}^{2} \cdot \left({\left(\cos theta\right)}^{2} \cdot {\left(\sin \phi_1\right)}^{2}\right), \mathsf{fma}\left(2, \sin delta \cdot \left(\cos \phi_1 \cdot \left({\left(\sin \phi_1\right)}^{3} \cdot \left(\cos delta \cdot \cos theta\right)\right)\right), {\left(\sin \phi_1\right)}^{4} \cdot {\left(\cos delta\right)}^{2}\right)\right)}{\mathsf{fma}\left(\cos \phi_1 \cdot \left(\cos theta \cdot \sin \phi_1\right), \sin delta, \mathsf{fma}\left(\cos delta, {\left(\sin \phi_1\right)}^{2}, \cos delta\right)\right)}}}\]
  13. Using strategy rm
  14. Applied add-sqr-sqrt0.2

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

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

Reproduce

herbie shell --seed 2019209 +o rules:numerics
(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))))))))))