Average Error: 18.9 → 12.5
Time: 5.3s
Precision: 64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell = -\infty:\\ \;\;\;\;\left(c0 \cdot \sqrt{\sqrt{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{V} \cdot \sqrt[3]{V}} \cdot \frac{\frac{A}{\ell}}{\sqrt[3]{V}}}}\right) \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\\ \mathbf{elif}\;V \cdot \ell \le -3.8298761382279537 \cdot 10^{-292}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \le 1.56552358 \cdot 10^{-317}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{\frac{1}{V} \cdot A}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell = -\infty:\\
\;\;\;\;\left(c0 \cdot \sqrt{\sqrt{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{V} \cdot \sqrt[3]{V}} \cdot \frac{\frac{A}{\ell}}{\sqrt[3]{V}}}}\right) \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\\

\mathbf{elif}\;V \cdot \ell \le -3.8298761382279537 \cdot 10^{-292}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V \cdot \ell}{A}}}\\

\mathbf{elif}\;V \cdot \ell \le 1.56552358 \cdot 10^{-317}:\\
\;\;\;\;\frac{c0 \cdot \sqrt{\frac{1}{V} \cdot A}}{\sqrt{\ell}}\\

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

\end{array}
double code(double c0, double A, double V, double l) {
	return (c0 * sqrt((A / (V * l))));
}
double code(double c0, double A, double V, double l) {
	double VAR;
	if (((V * l) <= -inf.0)) {
		VAR = ((c0 * sqrt(sqrt((((cbrt(1.0) * cbrt(1.0)) / (cbrt(V) * cbrt(V))) * ((A / l) / cbrt(V)))))) * sqrt(sqrt(((1.0 / V) * (A / l)))));
	} else {
		double VAR_1;
		if (((V * l) <= -3.8298761382279537e-292)) {
			VAR_1 = (c0 * sqrt((1.0 / ((V * l) / A))));
		} else {
			double VAR_2;
			if (((V * l) <= 1.5655235790231e-317)) {
				VAR_2 = ((c0 * sqrt(((1.0 / V) * A))) / sqrt(l));
			} else {
				VAR_2 = (c0 * (sqrt(A) * sqrt((1.0 / (V * l)))));
			}
			VAR_1 = VAR_2;
		}
		VAR = VAR_1;
	}
	return VAR;
}

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 4 regimes
  2. if (* V l) < -inf.0

    1. Initial program 40.5

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

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}}\]
    4. Applied times-frac23.3

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

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

      \[\leadsto \color{blue}{\left(c0 \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\right) \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}}\]
    8. Using strategy rm
    9. Applied add-cube-cbrt23.4

      \[\leadsto \left(c0 \cdot \sqrt{\sqrt{\frac{1}{\color{blue}{\left(\sqrt[3]{V} \cdot \sqrt[3]{V}\right) \cdot \sqrt[3]{V}}} \cdot \frac{A}{\ell}}}\right) \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\]
    10. Applied add-cube-cbrt23.4

      \[\leadsto \left(c0 \cdot \sqrt{\sqrt{\frac{\color{blue}{\left(\sqrt[3]{1} \cdot \sqrt[3]{1}\right) \cdot \sqrt[3]{1}}}{\left(\sqrt[3]{V} \cdot \sqrt[3]{V}\right) \cdot \sqrt[3]{V}} \cdot \frac{A}{\ell}}}\right) \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\]
    11. Applied times-frac23.4

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

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

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

    if -inf.0 < (* V l) < -3.8298761382279537e-292

    1. Initial program 9.4

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

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

    if -3.8298761382279537e-292 < (* V l) < 1.5655235790231e-317

    1. Initial program 59.9

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

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}}\]
    4. Applied times-frac38.0

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{1}{V} \cdot A}{\ell}}}\]
    7. Applied sqrt-div40.4

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{1}{V} \cdot A}}{\sqrt{\ell}}}\]
    8. Applied associate-*r/41.0

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

    if 1.5655235790231e-317 < (* V l)

    1. Initial program 15.1

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{A \cdot \frac{1}{V \cdot \ell}}}\]
    4. Applied sqrt-prod7.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell = -\infty:\\ \;\;\;\;\left(c0 \cdot \sqrt{\sqrt{\frac{\sqrt[3]{1} \cdot \sqrt[3]{1}}{\sqrt[3]{V} \cdot \sqrt[3]{V}} \cdot \frac{\frac{A}{\ell}}{\sqrt[3]{V}}}}\right) \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\\ \mathbf{elif}\;V \cdot \ell \le -3.8298761382279537 \cdot 10^{-292}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \le 1.56552358 \cdot 10^{-317}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{\frac{1}{V} \cdot A}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)\\ \end{array}\]

Reproduce

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