Average Error: 58.1 → 31.5
Time: 2.3m
Precision: 64
Internal Precision: 128
\[\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{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \le -9.967372322992577 \cdot 10^{+23} \lor \neg \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \le 3.7277262963574675 \cdot 10^{+292}\right):\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\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)}\right) \cdot \frac{c0}{2 \cdot w}\\ \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

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 2 regimes
  2. if (/ (* c0 (* d d)) (* (* w h) (* D D))) < -9.967372322992577e+23 or 3.7277262963574675e+292 < (/ (* c0 (* d d)) (* (* w h) (* D D)))

    1. Initial program 62.0

      \[\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. Initial simplification57.6

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

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

    if -9.967372322992577e+23 < (/ (* c0 (* d d)) (* (* w h) (* D D))) < 3.7277262963574675e+292

    1. Initial program 30.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)\]
  3. Recombined 2 regimes into one program.
  4. Final simplification31.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \le -9.967372322992577 \cdot 10^{+23} \lor \neg \left(\frac{c0 \cdot \left(d \cdot d\right)}{\left(w \cdot h\right) \cdot \left(D \cdot D\right)} \le 3.7277262963574675 \cdot 10^{+292}\right):\\ \;\;\;\;0\\ \mathbf{else}:\\ \;\;\;\;\left(\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)}\right) \cdot \frac{c0}{2 \cdot w}\\ \end{array}\]

Runtime

Time bar (total: 2.3m)Debug logProfile

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