Average Error: 18.8 → 14.9
Time: 15.7s
Precision: 64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;\frac{A}{V \cdot \ell} \le 1.4484281441300371 \cdot 10^{-295}:\\ \;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\ \mathbf{elif}\;\frac{A}{V \cdot \ell} \le 9.7394205959520737 \cdot 10^{302}:\\ \;\;\;\;\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot c0\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{A} \cdot c0}{\sqrt{V \cdot \ell}}\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;\frac{A}{V \cdot \ell} \le 1.4484281441300371 \cdot 10^{-295}:\\
\;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\

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

\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{A} \cdot c0}{\sqrt{V \cdot \ell}}\\

\end{array}
double f(double c0, double A, double V, double l) {
        double r148245 = c0;
        double r148246 = A;
        double r148247 = V;
        double r148248 = l;
        double r148249 = r148247 * r148248;
        double r148250 = r148246 / r148249;
        double r148251 = sqrt(r148250);
        double r148252 = r148245 * r148251;
        return r148252;
}

double f(double c0, double A, double V, double l) {
        double r148253 = A;
        double r148254 = V;
        double r148255 = l;
        double r148256 = r148254 * r148255;
        double r148257 = r148253 / r148256;
        double r148258 = 1.4484281441300371e-295;
        bool r148259 = r148257 <= r148258;
        double r148260 = r148253 / r148254;
        double r148261 = r148260 / r148255;
        double r148262 = sqrt(r148261);
        double r148263 = c0;
        double r148264 = r148262 * r148263;
        double r148265 = 9.739420595952074e+302;
        bool r148266 = r148257 <= r148265;
        double r148267 = sqrt(r148257);
        double r148268 = sqrt(r148267);
        double r148269 = r148268 * r148263;
        double r148270 = r148268 * r148269;
        double r148271 = sqrt(r148253);
        double r148272 = r148271 * r148263;
        double r148273 = sqrt(r148256);
        double r148274 = r148272 / r148273;
        double r148275 = r148266 ? r148270 : r148274;
        double r148276 = r148259 ? r148264 : r148275;
        return r148276;
}

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 (/ A (* V l)) < 1.4484281441300371e-295

    1. Initial program 38.0

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

      \[\leadsto \color{blue}{\sqrt{\frac{A}{V \cdot \ell}} \cdot c0}\]
    4. Using strategy rm
    5. Applied associate-/r*28.9

      \[\leadsto \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \cdot c0\]

    if 1.4484281441300371e-295 < (/ A (* V l)) < 9.739420595952074e+302

    1. Initial program 0.4

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

      \[\leadsto \color{blue}{\sqrt{\frac{A}{V \cdot \ell}} \cdot c0}\]
    4. Using strategy rm
    5. Applied add-sqr-sqrt0.4

      \[\leadsto \sqrt{\color{blue}{\sqrt{\frac{A}{V \cdot \ell}} \cdot \sqrt{\frac{A}{V \cdot \ell}}}} \cdot c0\]
    6. Applied sqrt-prod0.7

      \[\leadsto \color{blue}{\left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)} \cdot c0\]
    7. Applied associate-*l*0.7

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

    if 9.739420595952074e+302 < (/ A (* V l))

    1. Initial program 63.3

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

      \[\leadsto \color{blue}{\sqrt{\frac{A}{V \cdot \ell}} \cdot c0}\]
    4. Using strategy rm
    5. Applied sqrt-div50.5

      \[\leadsto \color{blue}{\frac{\sqrt{A}}{\sqrt{V \cdot \ell}}} \cdot c0\]
    6. Applied associate-*l/50.5

      \[\leadsto \color{blue}{\frac{\sqrt{A} \cdot c0}{\sqrt{V \cdot \ell}}}\]
  3. Recombined 3 regimes into one program.
  4. Final simplification14.9

    \[\leadsto \begin{array}{l} \mathbf{if}\;\frac{A}{V \cdot \ell} \le 1.4484281441300371 \cdot 10^{-295}:\\ \;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\ \mathbf{elif}\;\frac{A}{V \cdot \ell} \le 9.7394205959520737 \cdot 10^{302}:\\ \;\;\;\;\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot c0\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\sqrt{A} \cdot c0}{\sqrt{V \cdot \ell}}\\ \end{array}\]

Reproduce

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