Average Error: 58.1 → 48.1
Time: 1.1m
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 -1.7399590492020498 \cdot 10^{+73}:\\ \;\;\;\;\frac{c0}{2} \cdot \frac{2 \cdot \left(\left(\sqrt[3]{\frac{d}{D}} \cdot \sqrt[3]{\frac{d}{D}}\right) \cdot \left(\left(\frac{d}{D} \cdot \frac{c0}{w \cdot h}\right) \cdot \sqrt[3]{\frac{d}{D}}\right)\right)}{w}\\ \mathbf{elif}\;c0 \le -1.1801178047435498 \cdot 10^{-268}:\\ \;\;\;\;\frac{2}{w} \cdot \left(\left(\frac{c0}{2} \cdot \frac{\frac{c0}{h} \cdot \frac{d}{D}}{w}\right) \cdot \frac{d}{D}\right)\\ \mathbf{elif}\;c0 \le 6.02676577709074 \cdot 10^{-283}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)}}{h}\\ \mathbf{elif}\;c0 \le 1.9060103432990615 \cdot 10^{+67}:\\ \;\;\;\;\frac{2}{w} \cdot \left(\left(\frac{c0}{2} \cdot \frac{\frac{c0}{h} \cdot \frac{d}{D}}{w}\right) \cdot \frac{d}{D}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2} \cdot \frac{2 \cdot \left(\left(\sqrt[3]{\frac{d}{D}} \cdot \sqrt[3]{\frac{d}{D}}\right) \cdot \left(\left(\frac{d}{D} \cdot \frac{c0}{w \cdot h}\right) \cdot \sqrt[3]{\frac{d}{D}}\right)\right)}{w}\\ \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 -1.7399590492020498 \cdot 10^{+73}:\\
\;\;\;\;\frac{c0}{2} \cdot \frac{2 \cdot \left(\left(\sqrt[3]{\frac{d}{D}} \cdot \sqrt[3]{\frac{d}{D}}\right) \cdot \left(\left(\frac{d}{D} \cdot \frac{c0}{w \cdot h}\right) \cdot \sqrt[3]{\frac{d}{D}}\right)\right)}{w}\\

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

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

\mathbf{elif}\;c0 \le 1.9060103432990615 \cdot 10^{+67}:\\
\;\;\;\;\frac{2}{w} \cdot \left(\left(\frac{c0}{2} \cdot \frac{\frac{c0}{h} \cdot \frac{d}{D}}{w}\right) \cdot \frac{d}{D}\right)\\

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

\end{array}
double f(double c0, double w, double h, double D, double d, double M) {
        double r6716544 = c0;
        double r6716545 = 2.0;
        double r6716546 = w;
        double r6716547 = r6716545 * r6716546;
        double r6716548 = r6716544 / r6716547;
        double r6716549 = d;
        double r6716550 = r6716549 * r6716549;
        double r6716551 = r6716544 * r6716550;
        double r6716552 = h;
        double r6716553 = r6716546 * r6716552;
        double r6716554 = D;
        double r6716555 = r6716554 * r6716554;
        double r6716556 = r6716553 * r6716555;
        double r6716557 = r6716551 / r6716556;
        double r6716558 = r6716557 * r6716557;
        double r6716559 = M;
        double r6716560 = r6716559 * r6716559;
        double r6716561 = r6716558 - r6716560;
        double r6716562 = sqrt(r6716561);
        double r6716563 = r6716557 + r6716562;
        double r6716564 = r6716548 * r6716563;
        return r6716564;
}

double f(double c0, double w, double h, double D, double d, double __attribute__((unused)) M) {
        double r6716565 = c0;
        double r6716566 = -1.7399590492020498e+73;
        bool r6716567 = r6716565 <= r6716566;
        double r6716568 = 2.0;
        double r6716569 = r6716565 / r6716568;
        double r6716570 = d;
        double r6716571 = D;
        double r6716572 = r6716570 / r6716571;
        double r6716573 = cbrt(r6716572);
        double r6716574 = r6716573 * r6716573;
        double r6716575 = w;
        double r6716576 = h;
        double r6716577 = r6716575 * r6716576;
        double r6716578 = r6716565 / r6716577;
        double r6716579 = r6716572 * r6716578;
        double r6716580 = r6716579 * r6716573;
        double r6716581 = r6716574 * r6716580;
        double r6716582 = r6716568 * r6716581;
        double r6716583 = r6716582 / r6716575;
        double r6716584 = r6716569 * r6716583;
        double r6716585 = -1.1801178047435498e-268;
        bool r6716586 = r6716565 <= r6716585;
        double r6716587 = r6716568 / r6716575;
        double r6716588 = r6716565 / r6716576;
        double r6716589 = r6716588 * r6716572;
        double r6716590 = r6716589 / r6716575;
        double r6716591 = r6716569 * r6716590;
        double r6716592 = r6716591 * r6716572;
        double r6716593 = r6716587 * r6716592;
        double r6716594 = 6.02676577709074e-283;
        bool r6716595 = r6716565 <= r6716594;
        double r6716596 = r6716570 * r6716565;
        double r6716597 = r6716596 * r6716596;
        double r6716598 = r6716575 * r6716571;
        double r6716599 = r6716598 * r6716598;
        double r6716600 = r6716597 / r6716599;
        double r6716601 = r6716600 / r6716576;
        double r6716602 = 1.9060103432990615e+67;
        bool r6716603 = r6716565 <= r6716602;
        double r6716604 = r6716603 ? r6716593 : r6716584;
        double r6716605 = r6716595 ? r6716601 : r6716604;
        double r6716606 = r6716586 ? r6716593 : r6716605;
        double r6716607 = r6716567 ? r6716584 : r6716606;
        return r6716607;
}

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 < -1.7399590492020498e+73 or 1.9060103432990615e+67 < c0

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

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

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

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

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

      \[\leadsto \frac{c0}{2} \cdot \frac{\left(\color{blue}{\left(\left(\sqrt[3]{\frac{d}{D}} \cdot \sqrt[3]{\frac{d}{D}}\right) \cdot \sqrt[3]{\frac{d}{D}}\right)} \cdot \left(\frac{d}{D} \cdot \frac{c0}{w \cdot h}\right)\right) \cdot 2}{w}\]
    9. Applied associate-*l*53.2

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

    if -1.7399590492020498e+73 < c0 < -1.1801178047435498e-268 or 6.02676577709074e-283 < c0 < 1.9060103432990615e+67

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1801178047435498e-268 < c0 < 6.02676577709074e-283

    1. Initial program 57.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. Simplified47.4

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;c0 \le -1.7399590492020498 \cdot 10^{+73}:\\ \;\;\;\;\frac{c0}{2} \cdot \frac{2 \cdot \left(\left(\sqrt[3]{\frac{d}{D}} \cdot \sqrt[3]{\frac{d}{D}}\right) \cdot \left(\left(\frac{d}{D} \cdot \frac{c0}{w \cdot h}\right) \cdot \sqrt[3]{\frac{d}{D}}\right)\right)}{w}\\ \mathbf{elif}\;c0 \le -1.1801178047435498 \cdot 10^{-268}:\\ \;\;\;\;\frac{2}{w} \cdot \left(\left(\frac{c0}{2} \cdot \frac{\frac{c0}{h} \cdot \frac{d}{D}}{w}\right) \cdot \frac{d}{D}\right)\\ \mathbf{elif}\;c0 \le 6.02676577709074 \cdot 10^{-283}:\\ \;\;\;\;\frac{\frac{\left(d \cdot c0\right) \cdot \left(d \cdot c0\right)}{\left(w \cdot D\right) \cdot \left(w \cdot D\right)}}{h}\\ \mathbf{elif}\;c0 \le 1.9060103432990615 \cdot 10^{+67}:\\ \;\;\;\;\frac{2}{w} \cdot \left(\left(\frac{c0}{2} \cdot \frac{\frac{c0}{h} \cdot \frac{d}{D}}{w}\right) \cdot \frac{d}{D}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{2} \cdot \frac{2 \cdot \left(\left(\sqrt[3]{\frac{d}{D}} \cdot \sqrt[3]{\frac{d}{D}}\right) \cdot \left(\left(\frac{d}{D} \cdot \frac{c0}{w \cdot h}\right) \cdot \sqrt[3]{\frac{d}{D}}\right)\right)}{w}\\ \end{array}\]

Reproduce

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