Average Error: 58.5 → 30.7
Time: 5.5m
Precision: 64
Internal Precision: 6784
\[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)\]
\[\begin{array}{l} \mathbf{if}\;\frac{d}{D} \le -1.2991668396182404 \cdot 10^{+125}:\\ \;\;\;\;0\\ \mathbf{if}\;\frac{d}{D} \le -9.739266838305023 \cdot 10^{-99}:\\ \;\;\;\;\frac{\left(\frac{M}{w} \cdot c0\right) \cdot \frac{M}{2}}{\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{(\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) + \left(M \cdot \left(-M\right)\right))_*}}\\ \mathbf{if}\;\frac{d}{D} \le 2.876576559920104 \cdot 10^{-65}:\\ \;\;\;\;\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \left(\left(c0 \cdot \left(d \cdot d\right)\right) \cdot \frac{1}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right) - M \cdot M}\right)\\ \mathbf{if}\;\frac{d}{D} \le 2.6861931552886093 \cdot 10^{+103}:\\ \;\;\;\;\frac{\left(\frac{M}{w} \cdot c0\right) \cdot \frac{M}{2}}{\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{(\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) + \left(M \cdot \left(-M\right)\right))_*}}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Error

Bits error versus c0

Bits error versus w

Bits error versus h

Bits error versus D

Bits error versus d

Bits error versus M

Derivation

  1. Split input into 3 regimes
  2. if (/ d D) < -1.2991668396182404e+125 or 2.6861931552886093e+103 < (/ d D)

    1. Initial program 61.4

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)\]
    2. Taylor expanded around inf 28.1

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{0}\]
    3. Applied simplify23.3

      \[\leadsto \color{blue}{0}\]

    if -1.2991668396182404e+125 < (/ d D) < -9.739266838305023e-99 or 2.876576559920104e-65 < (/ d D) < 2.6861931552886093e+103

    1. Initial program 54.4

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)\]
    2. Using strategy rm
    3. Applied flip-+59.7

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \color{blue}{\frac{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M} \cdot \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}}}\]
    4. Applied simplify51.6

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{\color{blue}{0 + M \cdot M}}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}}\]
    5. Taylor expanded around 0 51.6

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \frac{0 + M \cdot M}{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \color{blue}{\frac{{d}^{2} \cdot c0}{{D}^{2} \cdot \left(h \cdot w\right)}} - M \cdot M}}\]
    6. Applied simplify38.1

      \[\leadsto \color{blue}{\frac{\frac{c0}{\frac{w \cdot 2}{M \cdot M}}}{\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{(\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) + \left(M \cdot \left(-M\right)\right))_*}}}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity38.1

      \[\leadsto \frac{\frac{c0}{\frac{w \cdot 2}{M \cdot M}}}{\color{blue}{1 \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{(\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) + \left(M \cdot \left(-M\right)\right))_*}\right)}}\]
    9. Applied associate-/r*38.1

      \[\leadsto \color{blue}{\frac{\frac{\frac{c0}{\frac{w \cdot 2}{M \cdot M}}}{1}}{\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right) - \sqrt{(\left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) \cdot \left(\frac{\frac{c0}{h}}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)\right) + \left(M \cdot \left(-M\right)\right))_*}}}\]
    10. Applied simplify36.8

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

    if -9.739266838305023e-99 < (/ d D) < 2.876576559920104e-65

    1. Initial program 54.5

      \[\frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} - M \cdot M}\right)\]
    2. Using strategy rm
    3. Applied div-inv54.7

      \[\leadsto \frac{c0}{2 \cdot w} \cdot \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} + \sqrt{\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \cdot \color{blue}{\left(\left(c0 \cdot \left(d \cdot d\right)\right) \cdot \frac{1}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)}\right)} - M \cdot M}\right)\]
  3. Recombined 3 regimes into one program.

Runtime

Time bar (total: 5.5m)Debug logProfile

herbie shell --seed '#(1070960995 739739648 2531964651 3069671617 351857262 3877178482)' +o rules:numerics
(FPCore (c0 w h D d M)
  :name "Henrywood and Agarwal, Equation (13)"
  (* (/ c0 (* 2 w)) (+ (/ (* c0 (* d d)) (* (* w h) (* D D))) (sqrt (- (* (/ (* c0 (* d d)) (* (* w h) (* D D))) (/ (* c0 (* d d)) (* (* w h) (* D D)))) (* M M))))))