Average Error: 58.1 → 34.5
Time: 58.5s
Precision: 64
\[\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}\;c0 \le -9.44050174334186 \cdot 10^{+78}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \le -8.253544300240584 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{c0}{w} \cdot \left(\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} + \sqrt{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} - M} \cdot \sqrt{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} + M}\right)}{2}\\ \mathbf{elif}\;c0 \le 6.249976079591383 \cdot 10^{-209}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \le 6.745254723698505 \cdot 10^{-175}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h} \cdot \frac{2}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)}}{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]
\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}\;c0 \le -9.44050174334186 \cdot 10^{+78}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \le -8.253544300240584 \cdot 10^{+42}:\\
\;\;\;\;\frac{\frac{c0}{w} \cdot \left(\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} + \sqrt{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} - M} \cdot \sqrt{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} + M}\right)}{2}\\

\mathbf{elif}\;c0 \le 6.249976079591383 \cdot 10^{-209}:\\
\;\;\;\;0\\

\mathbf{elif}\;c0 \le 6.745254723698505 \cdot 10^{-175}:\\
\;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h} \cdot \frac{2}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)}}{2}\\

\mathbf{else}:\\
\;\;\;\;0\\

\end{array}
double f(double c0, double w, double h, double D, double d, double M) {
        double r3272193 = c0;
        double r3272194 = 2.0;
        double r3272195 = w;
        double r3272196 = r3272194 * r3272195;
        double r3272197 = r3272193 / r3272196;
        double r3272198 = d;
        double r3272199 = r3272198 * r3272198;
        double r3272200 = r3272193 * r3272199;
        double r3272201 = h;
        double r3272202 = r3272195 * r3272201;
        double r3272203 = D;
        double r3272204 = r3272203 * r3272203;
        double r3272205 = r3272202 * r3272204;
        double r3272206 = r3272200 / r3272205;
        double r3272207 = r3272206 * r3272206;
        double r3272208 = M;
        double r3272209 = r3272208 * r3272208;
        double r3272210 = r3272207 - r3272209;
        double r3272211 = sqrt(r3272210);
        double r3272212 = r3272206 + r3272211;
        double r3272213 = r3272197 * r3272212;
        return r3272213;
}

double f(double c0, double w, double h, double D, double d, double M) {
        double r3272214 = c0;
        double r3272215 = -9.44050174334186e+78;
        bool r3272216 = r3272214 <= r3272215;
        double r3272217 = 0.0;
        double r3272218 = -8.253544300240584e+42;
        bool r3272219 = r3272214 <= r3272218;
        double r3272220 = w;
        double r3272221 = r3272214 / r3272220;
        double r3272222 = d;
        double r3272223 = D;
        double r3272224 = r3272222 / r3272223;
        double r3272225 = r3272224 * r3272224;
        double r3272226 = r3272225 * r3272221;
        double r3272227 = h;
        double r3272228 = r3272226 / r3272227;
        double r3272229 = M;
        double r3272230 = r3272228 - r3272229;
        double r3272231 = sqrt(r3272230);
        double r3272232 = r3272228 + r3272229;
        double r3272233 = sqrt(r3272232);
        double r3272234 = r3272231 * r3272233;
        double r3272235 = r3272228 + r3272234;
        double r3272236 = r3272221 * r3272235;
        double r3272237 = 2.0;
        double r3272238 = r3272236 / r3272237;
        double r3272239 = 6.249976079591383e-209;
        bool r3272240 = r3272214 <= r3272239;
        double r3272241 = 6.745254723698505e-175;
        bool r3272242 = r3272214 <= r3272241;
        double r3272243 = r3272222 * r3272214;
        double r3272244 = r3272243 * r3272243;
        double r3272245 = r3272244 / r3272227;
        double r3272246 = r3272220 * r3272223;
        double r3272247 = r3272246 * r3272246;
        double r3272248 = r3272237 / r3272247;
        double r3272249 = r3272245 * r3272248;
        double r3272250 = r3272249 / r3272237;
        double r3272251 = r3272242 ? r3272250 : r3272217;
        double r3272252 = r3272240 ? r3272217 : r3272251;
        double r3272253 = r3272219 ? r3272238 : r3272252;
        double r3272254 = r3272216 ? r3272217 : r3272253;
        return r3272254;
}

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 3 regimes
  2. if c0 < -9.44050174334186e+78 or -8.253544300240584e+42 < c0 < 6.249976079591383e-209 or 6.745254723698505e-175 < c0

    1. Initial program 58.1

      \[\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. Simplified52.0

      \[\leadsto \color{blue}{\frac{\left(\sqrt{\left(M + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \left(\frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h} - M\right)} + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \frac{c0}{w}}{2}}\]
    3. Using strategy rm
    4. Applied associate-*r*52.7

      \[\leadsto \frac{\left(\sqrt{\left(M + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \left(\frac{\color{blue}{\left(\frac{c0}{w} \cdot \frac{d}{D}\right) \cdot \frac{d}{D}}}{h} - M\right)} + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \frac{c0}{w}}{2}\]
    5. Using strategy rm
    6. Applied associate-*r*52.5

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

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

    if -9.44050174334186e+78 < c0 < -8.253544300240584e+42

    1. Initial program 57.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. Simplified51.6

      \[\leadsto \color{blue}{\frac{\left(\sqrt{\left(M + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \left(\frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h} - M\right)} + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \frac{c0}{w}}{2}}\]
    3. Using strategy rm
    4. Applied associate-*r*52.2

      \[\leadsto \frac{\left(\sqrt{\left(M + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \left(\frac{\color{blue}{\left(\frac{c0}{w} \cdot \frac{d}{D}\right) \cdot \frac{d}{D}}}{h} - M\right)} + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \frac{c0}{w}}{2}\]
    5. Using strategy rm
    6. Applied sqrt-prod52.9

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

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

    if 6.249976079591383e-209 < c0 < 6.745254723698505e-175

    1. Initial program 56.9

      \[\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. Simplified51.3

      \[\leadsto \color{blue}{\frac{\left(\sqrt{\left(M + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \left(\frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h} - M\right)} + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \frac{c0}{w}}{2}}\]
    3. Using strategy rm
    4. Applied associate-*r*51.9

      \[\leadsto \frac{\left(\sqrt{\left(M + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \left(\frac{\color{blue}{\left(\frac{c0}{w} \cdot \frac{d}{D}\right) \cdot \frac{d}{D}}}{h} - M\right)} + \frac{\frac{c0}{w} \cdot \left(\frac{d}{D} \cdot \frac{d}{D}\right)}{h}\right) \cdot \frac{c0}{w}}{2}\]
    5. Using strategy rm
    6. Applied associate-*r*51.8

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

      \[\leadsto \frac{\color{blue}{2 \cdot \frac{{c0}^{2} \cdot {d}^{2}}{{w}^{2} \cdot \left({D}^{2} \cdot h\right)}}}{2}\]
    8. Simplified47.5

      \[\leadsto \frac{\color{blue}{\frac{2}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)} \cdot \frac{\left(c0 \cdot d\right) \cdot \left(c0 \cdot d\right)}{h}}}{2}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification34.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \le -9.44050174334186 \cdot 10^{+78}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \le -8.253544300240584 \cdot 10^{+42}:\\ \;\;\;\;\frac{\frac{c0}{w} \cdot \left(\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} + \sqrt{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} - M} \cdot \sqrt{\frac{\left(\frac{d}{D} \cdot \frac{d}{D}\right) \cdot \frac{c0}{w}}{h} + M}\right)}{2}\\ \mathbf{elif}\;c0 \le 6.249976079591383 \cdot 10^{-209}:\\ \;\;\;\;0\\ \mathbf{elif}\;c0 \le 6.745254723698505 \cdot 10^{-175}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h} \cdot \frac{2}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)}}{2}\\ \mathbf{else}:\\ \;\;\;\;0\\ \end{array}\]

Reproduce

herbie shell --seed 2019132 
(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))))))