Average Error: 37.6 → 4.3
Time: 47.4s
Precision: 64
Internal Precision: 1344
\[R \cdot \sqrt{\left(\left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\frac{\phi_1 + \phi_2}{2}\right)\right) \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\frac{\phi_1 + \phi_2}{2}\right)\right) + \left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}\]
\[\sqrt{\left(\sqrt[3]{{\left(\cos \left(\frac{\phi_2 + \phi_1}{2}\right)\right)}^{3}} \cdot \left(\lambda_1 - \lambda_2\right)\right)^2 + \left(\phi_1 - \phi_2\right)^2}^* \cdot R\]

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 37.6

    \[R \cdot \sqrt{\left(\left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\frac{\phi_1 + \phi_2}{2}\right)\right) \cdot \left(\left(\lambda_1 - \lambda_2\right) \cdot \cos \left(\frac{\phi_1 + \phi_2}{2}\right)\right) + \left(\phi_1 - \phi_2\right) \cdot \left(\phi_1 - \phi_2\right)}\]
  2. Applied simplify4.2

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

    \[\leadsto \sqrt{\left(\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)}} \cdot \left(\lambda_1 - \lambda_2\right)\right)^2 + \left(\phi_1 - \phi_2\right)^2}^* \cdot R\]
  5. Applied simplify4.3

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

Runtime

Time bar (total: 47.4s)Debug logProfile

herbie shell --seed '#(1072936661 1621281212 3440817831 3219514234 460296804 1258167384)' +o rules:numerics
(FPCore (R lambda1 lambda2 phi1 phi2)
  :name "Equirectangular approximation to distance on a great circle"
  (* R (sqrt (+ (* (* (- lambda1 lambda2) (cos (/ (+ phi1 phi2) 2))) (* (- lambda1 lambda2) (cos (/ (+ phi1 phi2) 2)))) (* (- phi1 phi2) (- phi1 phi2))))))