Average Error: 13.9 → 10.7
Time: 27.2s
Precision: 64
Internal Precision: 320
\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{M \cdot D}{2 \cdot d} \le -6.1903825147609 \cdot 10^{-70}:\\ \;\;\;\;\sqrt{(\left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(-\frac{h}{\ell}\right) + 1)_*} \cdot w0\\ \mathbf{elif}\;\frac{M \cdot D}{2 \cdot d} \le 4.1767165966058094 \cdot 10^{-257} \lor \neg \left(\frac{M \cdot D}{2 \cdot d} \le 1.2639006077927757 \cdot 10^{+132}\right):\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot w0\\ \end{array}\]

Error

Bits error versus w0

Bits error versus M

Bits error versus D

Bits error versus h

Bits error versus l

Bits error versus d

Derivation

  1. Split input into 3 regimes
  2. if (/ (* M D) (* 2 d)) < -6.1903825147609e-70

    1. Initial program 26.2

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
    2. Initial simplification25.8

      \[\leadsto \sqrt{(\left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(-\frac{h}{\ell}\right) + 1)_*} \cdot w0\]

    if -6.1903825147609e-70 < (/ (* M D) (* 2 d)) < 4.1767165966058094e-257 or 1.2639006077927757e+132 < (/ (* M D) (* 2 d))

    1. Initial program 13.2

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
    2. Initial simplification12.8

      \[\leadsto \sqrt{(\left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(-\frac{h}{\ell}\right) + 1)_*} \cdot w0\]
    3. Taylor expanded around 0 7.7

      \[\leadsto \color{blue}{1} \cdot w0\]

    if 4.1767165966058094e-257 < (/ (* M D) (* 2 d)) < 1.2639006077927757e+132

    1. Initial program 6.0

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification10.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{M \cdot D}{2 \cdot d} \le -6.1903825147609 \cdot 10^{-70}:\\ \;\;\;\;\sqrt{(\left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(-\frac{h}{\ell}\right) + 1)_*} \cdot w0\\ \mathbf{elif}\;\frac{M \cdot D}{2 \cdot d} \le 4.1767165966058094 \cdot 10^{-257} \lor \neg \left(\frac{M \cdot D}{2 \cdot d} \le 1.2639006077927757 \cdot 10^{+132}\right):\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{1 - \frac{h}{\ell} \cdot {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2}} \cdot w0\\ \end{array}\]

Runtime

Time bar (total: 27.2s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes14.010.79.24.869.3%
herbie shell --seed 2018296 +o rules:numerics
(FPCore (w0 M D h l d)
  :name "Henrywood and Agarwal, Equation (9a)"
  (* w0 (sqrt (- 1 (* (pow (/ (* M D) (* 2 d)) 2) (/ h l))))))