Average Error: 18.9 → 8.8
Time: 2.9s
Precision: 64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell = -\infty:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \le -3.8298761382279537 \cdot 10^{-292}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{\sqrt{-A}}}\\ \mathbf{elif}\;V \cdot \ell \le 1.56552358 \cdot 10^{-317}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\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:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\

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

\mathbf{elif}\;V \cdot \ell \le 1.56552358 \cdot 10^{-317}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\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((V * (l / A))));
	} else {
		double VAR_1;
		if (((V * l) <= -3.8298761382279537e-292)) {
			VAR_1 = (c0 / (sqrt((V * -l)) / sqrt(-A)));
		} else {
			double VAR_2;
			if (((V * l) <= 1.5655235790231e-317)) {
				VAR_2 = (c0 * (sqrt((A / V)) / 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 *-commutative40.5

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}}\]
    5. Using strategy rm
    6. Applied clear-num23.3

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\frac{1}{\frac{\ell}{A}}}}{V}}\]
    7. Applied associate-/l/24.1

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V \cdot \frac{\ell}{A}}}}\]
    8. Applied sqrt-div24.1

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

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

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

    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 *-commutative9.4

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{\ell}}{V}}}\]
    5. Using strategy rm
    6. Applied clear-num16.3

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\frac{1}{\frac{\ell}{A}}}}{V}}\]
    7. Applied associate-/l/16.4

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V \cdot \frac{\ell}{A}}}}\]
    8. Applied sqrt-div16.2

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

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

      \[\leadsto \frac{\color{blue}{c0}}{\sqrt{V \cdot \frac{\ell}{A}}}\]
    11. Using strategy rm
    12. Applied frac-2neg16.1

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

      \[\leadsto \frac{c0}{\sqrt{\color{blue}{\frac{V \cdot \left(-\ell\right)}{-A}}}}\]
    14. Applied sqrt-div0.4

      \[\leadsto \frac{c0}{\color{blue}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{\sqrt{-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 associate-/r*38.0

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

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{A}{V}}}{\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 simplification8.8

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

Reproduce

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