Average Error: 13.6 → 9.1
Time: 27.0s
Precision: 64
Internal Precision: 576
\[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
\[\begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \le 3.492668935386995 \cdot 10^{-08}:\\ \;\;\;\;w0 \cdot \left|\sqrt{(\left(\frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{-h}{\ell}\right) + 1)_*}\right|\\ \mathbf{else}:\\ \;\;\;\;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 2 regimes
  2. if (* (pow (/ (* M D) (* 2 d)) 2) (/ h l)) < 3.492668935386995e-08

    1. Initial program 9.0

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

      \[\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. Using strategy rm
    4. Applied expm1-log1p-u9.5

      \[\leadsto \sqrt{\color{blue}{(e^{\log_* (1 + (\left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(-\frac{h}{\ell}\right) + 1)_*)} - 1)^*}} \cdot w0\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt9.5

      \[\leadsto \sqrt{\color{blue}{\sqrt{(e^{\log_* (1 + (\left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(-\frac{h}{\ell}\right) + 1)_*)} - 1)^*} \cdot \sqrt{(e^{\log_* (1 + (\left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(-\frac{h}{\ell}\right) + 1)_*)} - 1)^*}}} \cdot w0\]
    7. Applied rem-sqrt-square9.5

      \[\leadsto \color{blue}{\left|\sqrt{(e^{\log_* (1 + (\left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(-\frac{h}{\ell}\right) + 1)_*)} - 1)^*}\right|} \cdot w0\]
    8. Simplified8.2

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

    if 3.492668935386995e-08 < (* (pow (/ (* M D) (* 2 d)) 2) (/ h l))

    1. Initial program 60.4

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

      \[\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 17.5

      \[\leadsto \color{blue}{1} \cdot w0\]
  3. Recombined 2 regimes into one program.
  4. Final simplification9.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;{\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell} \le 3.492668935386995 \cdot 10^{-08}:\\ \;\;\;\;w0 \cdot \left|\sqrt{(\left(\frac{\frac{M}{2}}{\frac{d}{D}}\right) \cdot \left(\frac{\frac{M}{2}}{\frac{d}{D}} \cdot \frac{-h}{\ell}\right) + 1)_*}\right|\\ \mathbf{else}:\\ \;\;\;\;w0\\ \end{array}\]

Runtime

Time bar (total: 27.0s)Debug logProfile

BaselineHerbieOracleSpan%
Regimes12.29.18.33.881.3%
herbie shell --seed 2018274 +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))))))