Average Error: 13.7 → 8.2
Time: 2.1m
Precision: 64
Internal Precision: 128
\[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:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\frac{D \cdot M}{2 \cdot d} \cdot h\right) \cdot \frac{D \cdot M}{2 \cdot d}}{\ell}}\\ \mathbf{elif}\;\frac{h}{\ell} \le -4.167633920028256 \cdot 10^{-291}:\\ \;\;\;\;\sqrt{1 - \frac{D \cdot M}{2 \cdot d} \cdot \left(\frac{h}{\ell} \cdot \frac{D \cdot M}{2 \cdot d}\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\frac{D \cdot M}{2 \cdot d} \cdot h\right) \cdot \frac{D \cdot M}{2 \cdot d}}{\ell}}\\ \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 -4.167633920028256e-291 < (/ 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. Simplified13.7

      \[\leadsto \color{blue}{\sqrt{1 - \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \cdot w0}\]
    3. Using strategy rm
    4. Applied associate-*r/7.0

      \[\leadsto \sqrt{1 - \color{blue}{\frac{\left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot h}{\ell}}} \cdot w0\]
    5. Using strategy rm
    6. Applied associate-*l*5.0

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

    if -inf.0 < (/ h l) < -4.167633920028256e-291

    1. Initial program 13.7

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

      \[\leadsto \color{blue}{\sqrt{1 - \left(\frac{M \cdot D}{2 \cdot d} \cdot \frac{M \cdot D}{2 \cdot d}\right) \cdot \frac{h}{\ell}} \cdot w0}\]
    3. Using strategy rm
    4. Applied associate-*l*12.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{h}{\ell} = -\infty:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\frac{D \cdot M}{2 \cdot d} \cdot h\right) \cdot \frac{D \cdot M}{2 \cdot d}}{\ell}}\\ \mathbf{elif}\;\frac{h}{\ell} \le -4.167633920028256 \cdot 10^{-291}:\\ \;\;\;\;\sqrt{1 - \frac{D \cdot M}{2 \cdot d} \cdot \left(\frac{h}{\ell} \cdot \frac{D \cdot M}{2 \cdot d}\right)} \cdot w0\\ \mathbf{else}:\\ \;\;\;\;w0 \cdot \sqrt{1 - \frac{\left(\frac{D \cdot M}{2 \cdot d} \cdot h\right) \cdot \frac{D \cdot M}{2 \cdot d}}{\ell}}\\ \end{array}\]

Reproduce

herbie shell --seed 2019089 
(FPCore (w0 M D h l d)
  :name "Henrywood and Agarwal, Equation (9a)"
  (* w0 (sqrt (- 1 (* (pow (/ (* M D) (* 2 d)) 2) (/ h l))))))