Average Error: 13.8 → 8.9
Time: 32.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}\;\frac{h}{\ell} = -\infty \lor \neg \left(\frac{h}{\ell} \le -1.6314164796059603 \cdot 10^{-306}\right):\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left|\sqrt{(\left(\frac{1}{4} \cdot \frac{D \cdot M}{d}\right) \cdot \left(\frac{D \cdot M}{d} \cdot \left(-\frac{h}{\ell}\right)\right) + 1)_*}\right|\\ \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 (/ h l) < -inf.0 or -1.6314164796059603e-306 < (/ h l)

    1. Initial program 13.7

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

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

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

    if -inf.0 < (/ h l) < -1.6314164796059603e-306

    1. Initial program 14.0

      \[w0 \cdot \sqrt{1 - {\left(\frac{M \cdot D}{2 \cdot d}\right)}^{2} \cdot \frac{h}{\ell}}\]
    2. Initial simplification13.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 14.5

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

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

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

      \[\leadsto \left|\color{blue}{\sqrt{(\left(\frac{D \cdot M}{d} \cdot \frac{1}{4}\right) \cdot \left(\frac{D \cdot M}{d} \cdot \frac{-h}{\ell}\right) + 1)_*}}\right| \cdot w0\]
  3. Recombined 2 regimes into one program.
  4. Final simplification8.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} = -\infty \lor \neg \left(\frac{h}{\ell} \le -1.6314164796059603 \cdot 10^{-306}\right):\\ \;\;\;\;w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \left|\sqrt{(\left(\frac{1}{4} \cdot \frac{D \cdot M}{d}\right) \cdot \left(\frac{D \cdot M}{d} \cdot \left(-\frac{h}{\ell}\right)\right) + 1)_*}\right|\\ \end{array}\]

Runtime

Time bar (total: 32.0s)Debug logProfile

herbie shell --seed 2018255 +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))))))