Average Error: 19.6 → 11.1
Time: 9.9s
Precision: 64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell = -\infty:\\ \;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\ \mathbf{elif}\;V \cdot \ell \le -1.1040326208139251 \cdot 10^{-199}:\\ \;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)\\ \mathbf{elif}\;V \cdot \ell \le 1.13635 \cdot 10^{-322}:\\ \;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\ \mathbf{elif}\;V \cdot \ell \le 3.5878746922481627 \cdot 10^{303}:\\ \;\;\;\;1 \cdot \left(c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell = -\infty:\\
\;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\

\mathbf{elif}\;V \cdot \ell \le -1.1040326208139251 \cdot 10^{-199}:\\
\;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)\\

\mathbf{elif}\;V \cdot \ell \le 1.13635 \cdot 10^{-322}:\\
\;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\

\mathbf{elif}\;V \cdot \ell \le 3.5878746922481627 \cdot 10^{303}:\\
\;\;\;\;1 \cdot \left(c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\right)\\

\mathbf{else}:\\
\;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\

\end{array}
double f(double c0, double A, double V, double l) {
        double r384 = c0;
        double r385 = A;
        double r386 = V;
        double r387 = l;
        double r388 = r386 * r387;
        double r389 = r385 / r388;
        double r390 = sqrt(r389);
        double r391 = r384 * r390;
        return r391;
}

double f(double c0, double A, double V, double l) {
        double r392 = V;
        double r393 = l;
        double r394 = r392 * r393;
        double r395 = -inf.0;
        bool r396 = r394 <= r395;
        double r397 = 1.0;
        double r398 = c0;
        double r399 = A;
        double r400 = r399 / r392;
        double r401 = r400 / r393;
        double r402 = sqrt(r401);
        double r403 = r398 * r402;
        double r404 = r397 * r403;
        double r405 = -1.1040326208139251e-199;
        bool r406 = r394 <= r405;
        double r407 = r399 / r394;
        double r408 = sqrt(r407);
        double r409 = r398 * r408;
        double r410 = r397 * r409;
        double r411 = 1.1363509854349e-322;
        bool r412 = r394 <= r411;
        double r413 = 3.587874692248163e+303;
        bool r414 = r394 <= r413;
        double r415 = sqrt(r399);
        double r416 = sqrt(r394);
        double r417 = r415 / r416;
        double r418 = r398 * r417;
        double r419 = r397 * r418;
        double r420 = r414 ? r419 : r404;
        double r421 = r412 ? r404 : r420;
        double r422 = r406 ? r410 : r421;
        double r423 = r396 ? r404 : r422;
        return r423;
}

Error

Bits error versus c0

Bits error versus A

Bits error versus V

Bits error versus l

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation

  1. Split input into 3 regimes
  2. if (* V l) < -inf.0 or -1.1040326208139251e-199 < (* V l) < 1.1363509854349e-322 or 3.587874692248163e+303 < (* V l)

    1. Initial program 44.8

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity44.8

      \[\leadsto \color{blue}{1 \cdot \left(c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)}\]
    4. Using strategy rm
    5. Applied associate-/r*27.8

      \[\leadsto 1 \cdot \left(c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}}\right)\]

    if -inf.0 < (* V l) < -1.1040326208139251e-199

    1. Initial program 9.0

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity9.0

      \[\leadsto \color{blue}{1 \cdot \left(c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)}\]

    if 1.1363509854349e-322 < (* V l) < 3.587874692248163e+303

    1. Initial program 10.2

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identity10.2

      \[\leadsto \color{blue}{1 \cdot \left(c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)}\]
    4. Using strategy rm
    5. Applied sqrt-div0.7

      \[\leadsto 1 \cdot \left(c0 \cdot \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}}\right)\]
  3. Recombined 3 regimes into one program.
  4. Final simplification11.1

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell = -\infty:\\ \;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\ \mathbf{elif}\;V \cdot \ell \le -1.1040326208139251 \cdot 10^{-199}:\\ \;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\right)\\ \mathbf{elif}\;V \cdot \ell \le 1.13635 \cdot 10^{-322}:\\ \;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\ \mathbf{elif}\;V \cdot \ell \le 3.5878746922481627 \cdot 10^{303}:\\ \;\;\;\;1 \cdot \left(c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;1 \cdot \left(c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\right)\\ \end{array}\]

Reproduce

herbie shell --seed 2020025 +o rules:numerics
(FPCore (c0 A V l)
  :name "Henrywood and Agarwal, Equation (3)"
  :precision binary64
  (* c0 (sqrt (/ A (* V l)))))