Average Error: 19.0 → 13.2
Time: 5.1s
Precision: binary64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2.2350651313941505 \cdot 10^{+102}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -3.7060305688441786 \cdot 10^{-194}:\\ \;\;\;\;c0 \cdot \left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\left(c0 \cdot \sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V}}\right) \cdot \sqrt{\frac{\sqrt[3]{A}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -2.2350651313941505 \cdot 10^{+102}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V}{\frac{A}{\ell}}}}\\

\mathbf{elif}\;V \cdot \ell \leq -3.7060305688441786 \cdot 10^{-194}:\\
\;\;\;\;c0 \cdot \left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)\\

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\left(c0 \cdot \sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V}}\right) \cdot \sqrt{\frac{\sqrt[3]{A}}{\ell}}\\

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

\end{array}
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
 :precision binary64
 (if (<= (* V l) -2.2350651313941505e+102)
   (* c0 (sqrt (/ 1.0 (/ V (/ A l)))))
   (if (<= (* V l) -3.7060305688441786e-194)
     (* c0 (* (sqrt (sqrt (/ A (* V l)))) (sqrt (sqrt (/ A (* V l))))))
     (if (<= (* V l) 0.0)
       (* (* c0 (sqrt (/ (* (cbrt A) (cbrt A)) V))) (sqrt (/ (cbrt A) l)))
       (* c0 (/ (sqrt A) (sqrt (* V l))))))))
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 tmp;
	if ((V * l) <= -2.2350651313941505e+102) {
		tmp = c0 * sqrt(1.0 / (V / (A / l)));
	} else if ((V * l) <= -3.7060305688441786e-194) {
		tmp = c0 * (sqrt(sqrt(A / (V * l))) * sqrt(sqrt(A / (V * l))));
	} else if ((V * l) <= 0.0) {
		tmp = (c0 * sqrt((cbrt(A) * cbrt(A)) / V)) * sqrt(cbrt(A) / l);
	} else {
		tmp = c0 * (sqrt(A) / sqrt(V * l));
	}
	return tmp;
}

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 (*.f64 V l) < -2.2350651313941505e102

    1. Initial program 24.3

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

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

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

    if -2.2350651313941505e102 < (*.f64 V l) < -3.7060305688441786e-194

    1. Initial program 5.3

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

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

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

    if -3.7060305688441786e-194 < (*.f64 V l) < 0.0

    1. Initial program 47.6

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied add-cube-cbrt_binary6447.8

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{\left(\sqrt[3]{A} \cdot \sqrt[3]{A}\right) \cdot \sqrt[3]{A}}}{V \cdot \ell}}\]
    4. Applied times-frac_binary6432.2

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}}\]
    5. Applied sqrt-prod_binary6438.8

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

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

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

    if 0.0 < (*.f64 V l)

    1. Initial program 14.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2.2350651313941505 \cdot 10^{+102}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -3.7060305688441786 \cdot 10^{-194}:\\ \;\;\;\;c0 \cdot \left(\sqrt{\sqrt{\frac{A}{V \cdot \ell}}} \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}}}\right)\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\left(c0 \cdot \sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V}}\right) \cdot \sqrt{\frac{\sqrt[3]{A}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array}\]

Reproduce

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