Average Error: 37.3 → 3.8
Time: 44.0s
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(\cos \left(\frac{\phi_1 + \phi_2}{2}\right) \cdot \lambda_1 + \cos \left(\frac{\phi_1 + \phi_2}{2}\right) \cdot \left(-\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.3

    \[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 simplify3.8

    \[\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 sub-neg3.8

    \[\leadsto \sqrt{\left(\cos \left(\frac{\phi_1 + \phi_2}{2}\right) \cdot \color{blue}{\left(\lambda_1 + \left(-\lambda_2\right)\right)}\right)^2 + \left(\phi_1 - \phi_2\right)^2}^* \cdot R\]
  5. Applied distribute-lft-in3.8

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

Runtime

Time bar (total: 44.0s)Debug logProfile

herbie shell --seed '#(1072967564 1937075727 894099792 790700740 1036514779 1027793188)' +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))))))