Average Error: 18.9 → 12.1
Time: 4.4s
Precision: 64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \le -2.6220125092199022 \cdot 10^{-97}:\\ \;\;\;\;\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 3.80431 \cdot 10^{-322}:\\ \;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\ \mathbf{elif}\;V \cdot \ell \le 1.93687473196227216 \cdot 10^{296}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \cdot c0\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \le -2.6220125092199022 \cdot 10^{-97}:\\
\;\;\;\;\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 3.80431 \cdot 10^{-322}:\\
\;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\

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

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

\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) <= -2.622012509219902e-97)) {
		temp = ((c0 * sqrt(sqrt((A / (V * l))))) * sqrt(sqrt((A / (V * l)))));
	} else {
		double temp_1;
		if (((V * l) <= 3.8043054729776e-322)) {
			temp_1 = (sqrt(((A / V) / l)) * c0);
		} else {
			double temp_2;
			if (((V * l) <= 1.936874731962272e+296)) {
				temp_2 = (c0 * (sqrt(A) / sqrt((V * l))));
			} else {
				temp_2 = (sqrt(((1.0 / V) * (A / l))) * c0);
			}
			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) < -2.622012509219902e-97

    1. Initial program 13.7

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

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

      \[\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*13.9

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

    if -2.622012509219902e-97 < (* V l) < 3.8043054729776e-322

    1. Initial program 35.7

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

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

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

    if 3.8043054729776e-322 < (* V l) < 1.936874731962272e+296

    1. Initial program 10.7

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

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

    if 1.936874731962272e+296 < (* V l)

    1. Initial program 39.7

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

      \[\leadsto \color{blue}{\sqrt{\frac{A}{V \cdot \ell}} \cdot c0}\]
    4. Using strategy rm
    5. Applied *-un-lft-identity39.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \le -2.6220125092199022 \cdot 10^{-97}:\\ \;\;\;\;\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 3.80431 \cdot 10^{-322}:\\ \;\;\;\;\sqrt{\frac{\frac{A}{V}}{\ell}} \cdot c0\\ \mathbf{elif}\;V \cdot \ell \le 1.93687473196227216 \cdot 10^{296}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{1}{V} \cdot \frac{A}{\ell}} \cdot c0\\ \end{array}\]

Reproduce

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