Average Error: 59.2 → 50.3
Time: 45.9s
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}\;w \le -3.703832811596682002705890140507852421431 \cdot 10^{-173}:\\ \;\;\;\;\frac{\frac{\frac{2 \cdot \left(c0 \cdot d\right)}{D} \cdot \frac{c0 \cdot d}{w}}{h \cdot \left(w \cdot D\right)}}{2}\\ \mathbf{elif}\;w \le 643228046619691738325706931699712:\\ \;\;\;\;\frac{\frac{\frac{2}{w \cdot D} \cdot \frac{c0 \cdot d}{\frac{h}{c0 \cdot d}}}{D} \cdot \frac{1}{w}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{2 \cdot \left(c0 \cdot d\right)}{D} \cdot \frac{c0 \cdot d}{w}}{h \cdot \left(w \cdot D\right)}}{2}\\ \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}\;w \le -3.703832811596682002705890140507852421431 \cdot 10^{-173}:\\
\;\;\;\;\frac{\frac{\frac{2 \cdot \left(c0 \cdot d\right)}{D} \cdot \frac{c0 \cdot d}{w}}{h \cdot \left(w \cdot D\right)}}{2}\\

\mathbf{elif}\;w \le 643228046619691738325706931699712:\\
\;\;\;\;\frac{\frac{\frac{2}{w \cdot D} \cdot \frac{c0 \cdot d}{\frac{h}{c0 \cdot d}}}{D} \cdot \frac{1}{w}}{2}\\

\mathbf{else}:\\
\;\;\;\;\frac{\frac{\frac{2 \cdot \left(c0 \cdot d\right)}{D} \cdot \frac{c0 \cdot d}{w}}{h \cdot \left(w \cdot D\right)}}{2}\\

\end{array}
double f(double c0, double w, double h, double D, double d, double M) {
        double r8359431 = c0;
        double r8359432 = 2.0;
        double r8359433 = w;
        double r8359434 = r8359432 * r8359433;
        double r8359435 = r8359431 / r8359434;
        double r8359436 = d;
        double r8359437 = r8359436 * r8359436;
        double r8359438 = r8359431 * r8359437;
        double r8359439 = h;
        double r8359440 = r8359433 * r8359439;
        double r8359441 = D;
        double r8359442 = r8359441 * r8359441;
        double r8359443 = r8359440 * r8359442;
        double r8359444 = r8359438 / r8359443;
        double r8359445 = r8359444 * r8359444;
        double r8359446 = M;
        double r8359447 = r8359446 * r8359446;
        double r8359448 = r8359445 - r8359447;
        double r8359449 = sqrt(r8359448);
        double r8359450 = r8359444 + r8359449;
        double r8359451 = r8359435 * r8359450;
        return r8359451;
}

double f(double c0, double w, double h, double D, double d, double __attribute__((unused)) M) {
        double r8359452 = w;
        double r8359453 = -3.703832811596682e-173;
        bool r8359454 = r8359452 <= r8359453;
        double r8359455 = 2.0;
        double r8359456 = c0;
        double r8359457 = d;
        double r8359458 = r8359456 * r8359457;
        double r8359459 = r8359455 * r8359458;
        double r8359460 = D;
        double r8359461 = r8359459 / r8359460;
        double r8359462 = r8359458 / r8359452;
        double r8359463 = r8359461 * r8359462;
        double r8359464 = h;
        double r8359465 = r8359452 * r8359460;
        double r8359466 = r8359464 * r8359465;
        double r8359467 = r8359463 / r8359466;
        double r8359468 = 2.0;
        double r8359469 = r8359467 / r8359468;
        double r8359470 = 6.4322804661969174e+32;
        bool r8359471 = r8359452 <= r8359470;
        double r8359472 = r8359455 / r8359465;
        double r8359473 = r8359464 / r8359458;
        double r8359474 = r8359458 / r8359473;
        double r8359475 = r8359472 * r8359474;
        double r8359476 = r8359475 / r8359460;
        double r8359477 = 1.0;
        double r8359478 = r8359477 / r8359452;
        double r8359479 = r8359476 * r8359478;
        double r8359480 = r8359479 / r8359468;
        double r8359481 = r8359471 ? r8359480 : r8359469;
        double r8359482 = r8359454 ? r8359469 : r8359481;
        return r8359482;
}

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 w < -3.703832811596682e-173 or 6.4322804661969174e+32 < w

    1. Initial program 58.7

      \[\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. Simplified53.1

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

      \[\leadsto \frac{\color{blue}{\left(2 \cdot \frac{c0 \cdot {d}^{2}}{w \cdot \left({D}^{2} \cdot h\right)}\right)} \cdot \frac{c0}{w}}{2}\]
    4. Simplified54.6

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

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

      \[\leadsto \frac{\color{blue}{\frac{2}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}}{2}\]
    7. Using strategy rm
    8. Applied *-un-lft-identity51.5

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot 2}}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{2}\]
    9. Applied times-frac51.4

      \[\leadsto \frac{\color{blue}{\left(\frac{1}{w \cdot D} \cdot \frac{2}{w \cdot D}\right)} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{2}\]
    10. Applied associate-*l*49.2

      \[\leadsto \frac{\color{blue}{\frac{1}{w \cdot D} \cdot \left(\frac{2}{w \cdot D} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}\right)}}{2}\]
    11. Using strategy rm
    12. Applied associate-*r/48.1

      \[\leadsto \frac{\frac{1}{w \cdot D} \cdot \color{blue}{\frac{\frac{2}{w \cdot D} \cdot \left(\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)\right)}{h}}}{2}\]
    13. Applied frac-times48.8

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

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

    if -3.703832811596682e-173 < w < 6.4322804661969174e+32

    1. Initial program 60.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. Simplified55.1

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

      \[\leadsto \frac{\color{blue}{\left(2 \cdot \frac{c0 \cdot {d}^{2}}{w \cdot \left({D}^{2} \cdot h\right)}\right)} \cdot \frac{c0}{w}}{2}\]
    4. Simplified59.6

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

      \[\leadsto \frac{\color{blue}{2 \cdot \frac{{c0}^{2} \cdot {d}^{2}}{{w}^{2} \cdot \left({D}^{2} \cdot h\right)}}}{2}\]
    6. Simplified58.7

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

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot 2}}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{2}\]
    9. Applied times-frac58.7

      \[\leadsto \frac{\color{blue}{\left(\frac{1}{w \cdot D} \cdot \frac{2}{w \cdot D}\right)} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}}{2}\]
    10. Applied associate-*l*56.1

      \[\leadsto \frac{\color{blue}{\frac{1}{w \cdot D} \cdot \left(\frac{2}{w \cdot D} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}\right)}}{2}\]
    11. Using strategy rm
    12. Applied *-un-lft-identity56.1

      \[\leadsto \frac{\frac{\color{blue}{1 \cdot 1}}{w \cdot D} \cdot \left(\frac{2}{w \cdot D} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}\right)}{2}\]
    13. Applied times-frac56.1

      \[\leadsto \frac{\color{blue}{\left(\frac{1}{w} \cdot \frac{1}{D}\right)} \cdot \left(\frac{2}{w \cdot D} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}\right)}{2}\]
    14. Applied associate-*l*56.1

      \[\leadsto \frac{\color{blue}{\frac{1}{w} \cdot \left(\frac{1}{D} \cdot \left(\frac{2}{w \cdot D} \cdot \frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{h}\right)\right)}}{2}\]
    15. Simplified55.3

      \[\leadsto \frac{\frac{1}{w} \cdot \color{blue}{\frac{\frac{c0 \cdot d}{\frac{h}{c0 \cdot d}} \cdot \frac{2}{D \cdot w}}{D}}}{2}\]
  3. Recombined 2 regimes into one program.
  4. Final simplification50.3

    \[\leadsto \begin{array}{l} \mathbf{if}\;w \le -3.703832811596682002705890140507852421431 \cdot 10^{-173}:\\ \;\;\;\;\frac{\frac{\frac{2 \cdot \left(c0 \cdot d\right)}{D} \cdot \frac{c0 \cdot d}{w}}{h \cdot \left(w \cdot D\right)}}{2}\\ \mathbf{elif}\;w \le 643228046619691738325706931699712:\\ \;\;\;\;\frac{\frac{\frac{2}{w \cdot D} \cdot \frac{c0 \cdot d}{\frac{h}{c0 \cdot d}}}{D} \cdot \frac{1}{w}}{2}\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{\frac{2 \cdot \left(c0 \cdot d\right)}{D} \cdot \frac{c0 \cdot d}{w}}{h \cdot \left(w \cdot D\right)}}{2}\\ \end{array}\]

Reproduce

herbie shell --seed 2019174 
(FPCore (c0 w h D d M)
  :name "Henrywood and Agarwal, Equation (13)"
  (* (/ c0 (* 2.0 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))))))