Average Error: 24.3 → 24.3
Time: 30.9s
Precision: 64
Internal Precision: 1344
\[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\sin \left(\frac{\phi_1 - \phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\frac{\phi_1 - \phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)\]
\[\tan^{-1}_* \frac{\sqrt{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right) + \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right) \cdot \left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\sqrt[3]{\sqrt[3]{\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)\right)} \cdot \left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)\right)} \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right) - \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right) \cdot \left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(2 \cdot R\right)\]

Error

Bits error versus R

Bits error versus lambda1

Bits error versus lambda2

Bits error versus phi1

Bits error versus phi2

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Initial program 24.3

    \[R \cdot \left(2 \cdot \tan^{-1}_* \frac{\sqrt{{\left(\sin \left(\frac{\phi_1 - \phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)}}{\sqrt{1 - \left({\left(\sin \left(\frac{\phi_1 - \phi_2}{2}\right)\right)}^{2} + \left(\left(\cos \phi_1 \cdot \cos \phi_2\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}\right)\]
  2. Initial simplification24.3

    \[\leadsto \tan^{-1}_* \frac{\sqrt{\left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right) + \sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}}{\sqrt{\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right) - \left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right)}} \cdot \left(R \cdot 2\right)\]
  3. Using strategy rm
  4. Applied add-cbrt-cube24.3

    \[\leadsto \tan^{-1}_* \frac{\sqrt{\left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right) + \sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}}{\sqrt{\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \color{blue}{\sqrt[3]{\left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)}} - \left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right)}} \cdot \left(R \cdot 2\right)\]
  5. Using strategy rm
  6. Applied add-cbrt-cube24.3

    \[\leadsto \tan^{-1}_* \frac{\sqrt{\left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right) + \sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right)}}{\sqrt{\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sqrt[3]{\left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)\right) \cdot \color{blue}{\sqrt[3]{\left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)}}} - \left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right) \cdot \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right)}} \cdot \left(R \cdot 2\right)\]
  7. Final simplification24.3

    \[\leadsto \tan^{-1}_* \frac{\sqrt{\sin \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \sin \left(\frac{\phi_1 - \phi_2}{2}\right) + \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right) \cdot \left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}}{\sqrt{\sqrt[3]{\sqrt[3]{\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)\right)} \cdot \left(\cos \left(\frac{\phi_1 - \phi_2}{2}\right) \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right)\right)} \cdot \cos \left(\frac{\phi_1 - \phi_2}{2}\right) - \left(\sin \left(\frac{\lambda_1 - \lambda_2}{2}\right) \cdot \cos \phi_1\right) \cdot \left(\cos \phi_2 \cdot \sin \left(\frac{\lambda_1 - \lambda_2}{2}\right)\right)}} \cdot \left(2 \cdot R\right)\]

Runtime

Time bar (total: 30.9s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes24.324.323.80.50%
herbie shell --seed 2018296 
(FPCore (R lambda1 lambda2 phi1 phi2)
  :name "Distance on a great circle"
  (* R (* 2 (atan2 (sqrt (+ (pow (sin (/ (- phi1 phi2) 2)) 2) (* (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2))) (sin (/ (- lambda1 lambda2) 2))))) (sqrt (- 1 (+ (pow (sin (/ (- phi1 phi2) 2)) 2) (* (* (* (cos phi1) (cos phi2)) (sin (/ (- lambda1 lambda2) 2))) (sin (/ (- lambda1 lambda2) 2))))))))))