Average Error: 18.8 → 12.8
Time: 7.0s
Precision: binary64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \le -5.18379487786223505 \cdot 10^{-7}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \le 2.7242653601509 \cdot 10^{-311}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \le 3.6948338349367551 \cdot 10^{306}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \le -5.18379487786223505 \cdot 10^{-7}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\

\mathbf{elif}\;V \cdot \ell \le 2.7242653601509 \cdot 10^{-311}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

\mathbf{elif}\;V \cdot \ell \le 3.6948338349367551 \cdot 10^{306}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

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

\end{array}
double code(double c0, double A, double V, double l) {
	return ((double) (c0 * ((double) sqrt(((double) (A / ((double) (V * l))))))));
}
double code(double c0, double A, double V, double l) {
	double VAR;
	if ((((double) (V * l)) <= -5.183794877862235e-07)) {
		VAR = ((double) (c0 * ((double) sqrt(((double) (((double) (1.0 / V)) * ((double) (A / l))))))));
	} else {
		double VAR_1;
		if ((((double) (V * l)) <= 2.7242653601509e-311)) {
			VAR_1 = ((double) (c0 * ((double) sqrt(((double) (((double) (A / V)) / l))))));
		} else {
			double VAR_2;
			if ((((double) (V * l)) <= 3.694833834936755e+306)) {
				VAR_2 = ((double) (c0 * ((double) (((double) sqrt(A)) / ((double) sqrt(((double) (V * l))))))));
			} else {
				VAR_2 = ((double) (c0 * ((double) sqrt(((double) (((double) (A / 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 3 regimes
  2. if (* V l) < -5.18379487786223505e-7

    1. Initial program 15.9

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

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

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

    if -5.18379487786223505e-7 < (* V l) < 2.7242653601509e-311 or 3.6948338349367551e306 < (* V l)

    1. Initial program 31.0

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

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

    if 2.7242653601509e-311 < (* V l) < 3.6948338349367551e306

    1. Initial program 10.2

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \le -5.18379487786223505 \cdot 10^{-7}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \le 2.7242653601509 \cdot 10^{-311}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \le 3.6948338349367551 \cdot 10^{306}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array}\]

Reproduce

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