Average Error: 19.2 → 11.5
Time: 5.0s
Precision: 64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \le -2.31733356004164906 \cdot 10^{116}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \le -1.36342088670765278 \cdot 10^{-299}:\\ \;\;\;\;\left(c0 \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right) \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\\ \mathbf{elif}\;V \cdot \ell \le 4.792590053780954 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{\ell}}}{\sqrt{V}}\\ \mathbf{elif}\;V \cdot \ell \le 4.03981149832835881 \cdot 10^{300}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \le -2.31733356004164906 \cdot 10^{116}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\

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

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

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\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)) <= -2.317333560041649e+116)) {
		VAR = ((double) (c0 * ((double) sqrt(((double) (((double) (A / V)) / l))))));
	} else {
		double VAR_1;
		if ((((double) (V * l)) <= -1.3634208867076528e-299)) {
			VAR_1 = ((double) (((double) (c0 * ((double) sqrt(((double) sqrt(((double) (A / ((double) (V * l)))))))))) * ((double) sqrt(((double) sqrt(((double) (A / ((double) (V * l))))))))));
		} else {
			double VAR_2;
			if ((((double) (V * l)) <= 4.79259005378095e-310)) {
				VAR_2 = ((double) (c0 * ((double) (((double) sqrt(((double) (A / l)))) / ((double) sqrt(V))))));
			} else {
				double VAR_3;
				if ((((double) (V * l)) <= 4.039811498328359e+300)) {
					VAR_3 = ((double) (c0 * ((double) (((double) sqrt(A)) / ((double) sqrt(((double) (V * l))))))));
				} else {
					VAR_3 = ((double) (c0 * ((double) sqrt(((double) (((double) (1.0 / V)) * ((double) (A / l))))))));
				}
				VAR_2 = VAR_3;
			}
			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 5 regimes
  2. if (* V l) < -2.317333560041649e+116

    1. Initial program 24.0

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

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

    if -2.317333560041649e+116 < (* V l) < -1.3634208867076528e-299

    1. Initial program 8.6

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied add-sqr-sqrt8.6

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

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

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

    if -1.3634208867076528e-299 < (* V l) < 4.79259005378095e-310

    1. Initial program 60.1

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

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

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

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

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

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

    if 4.79259005378095e-310 < (* V l) < 4.039811498328359e+300

    1. Initial program 9.8

      \[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}}}\]

    if 4.039811498328359e+300 < (* V l)

    1. Initial program 39.2

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \le -2.31733356004164906 \cdot 10^{116}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \le -1.36342088670765278 \cdot 10^{-299}:\\ \;\;\;\;\left(c0 \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right) \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\\ \mathbf{elif}\;V \cdot \ell \le 4.792590053780954 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{\ell}}}{\sqrt{V}}\\ \mathbf{elif}\;V \cdot \ell \le 4.03981149832835881 \cdot 10^{300}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \end{array}\]

Reproduce

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