Average Error: 19.0 → 14.1
Time: 5.0s
Precision: 64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \le -6.04930864463111567 \cdot 10^{-251}:\\ \;\;\;\;c0 \cdot \left(\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}}}} \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\right)\\ \mathbf{elif}\;V \cdot \ell \le 1.2426573619189175 \cdot 10^{-285}:\\ \;\;\;\;\left(c0 \cdot \sqrt{\frac{1}{V}}\right) \cdot \sqrt{\frac{A}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \le 5.5957256550553615 \cdot 10^{297}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)\\ \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 -6.04930864463111567 \cdot 10^{-251}:\\
\;\;\;\;c0 \cdot \left(\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}}}} \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\right)\\

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

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

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

\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 temp;
	if (((V * l) <= -6.049308644631116e-251)) {
		temp = (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 temp_1;
		if (((V * l) <= 1.2426573619189175e-285)) {
			temp_1 = ((c0 * sqrt((1.0 / V))) * sqrt((A / l)));
		} else {
			double temp_2;
			if (((V * l) <= 5.595725655055362e+297)) {
				temp_2 = (c0 * (sqrt(A) * sqrt((1.0 / (V * l)))));
			} else {
				temp_2 = (c0 * sqrt(((A / V) / l)));
			}
			temp_1 = temp_2;
		}
		temp = temp_1;
	}
	return temp;
}

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) < -6.049308644631116e-251

    1. Initial program 14.4

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

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}}\]
    5. Using strategy rm
    6. Applied add-sqr-sqrt17.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. Using strategy rm
    8. Applied add-cube-cbrt17.4

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

      \[\leadsto c0 \cdot \left(\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}}} \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\right)\]
    10. Applied times-frac17.4

      \[\leadsto c0 \cdot \left(\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}}} \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\right)\]
    11. Applied associate-*l*17.4

      \[\leadsto c0 \cdot \left(\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)}}} \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\right)\]
    12. Simplified17.4

      \[\leadsto c0 \cdot \left(\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}}}}} \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\right)\]

    if -6.049308644631116e-251 < (* V l) < 1.2426573619189175e-285

    1. Initial program 51.7

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

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

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

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

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

    if 1.2426573619189175e-285 < (* V l) < 5.595725655055362e+297

    1. Initial program 9.4

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

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

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

    if 5.595725655055362e+297 < (* V l)

    1. Initial program 38.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \le -6.04930864463111567 \cdot 10^{-251}:\\ \;\;\;\;c0 \cdot \left(\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}}}} \cdot \sqrt{\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}}\right)\\ \mathbf{elif}\;V \cdot \ell \le 1.2426573619189175 \cdot 10^{-285}:\\ \;\;\;\;\left(c0 \cdot \sqrt{\frac{1}{V}}\right) \cdot \sqrt{\frac{A}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \le 5.5957256550553615 \cdot 10^{297}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array}\]

Reproduce

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