Average Error: 19.4 → 8.2
Time: 7.0s
Precision: binary64
\[[V, l]=\mathsf{sort}([V, l])\]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2.5544578074395034 \cdot 10^{+133}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -9.65057506402844 \cdot 10^{-82}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 3.6165605275579 \cdot 10^{-321}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.7083351686448145 \cdot 10^{+281}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V} \cdot \frac{1}{\ell}}\\ \end{array}\]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -2.5544578074395034 \cdot 10^{+133}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

\mathbf{elif}\;V \cdot \ell \leq -9.65057506402844 \cdot 10^{-82}:\\
\;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\

\mathbf{elif}\;V \cdot \ell \leq 3.6165605275579 \cdot 10^{-321}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\

\mathbf{elif}\;V \cdot \ell \leq 1.7083351686448145 \cdot 10^{+281}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V} \cdot \frac{1}{\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.5544578074395034e+133)
   (* c0 (/ (sqrt (/ A V)) (sqrt l)))
   (if (<= (* V l) -9.65057506402844e-82)
     (* c0 (sqrt (* A (/ 1.0 (* V l)))))
     (if (<= (* V l) 3.6165605275579e-321)
       (* c0 (/ (sqrt (/ A V)) (sqrt l)))
       (if (<= (* V l) 1.7083351686448145e+281)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (* c0 (sqrt (* (/ A V) (/ 1.0 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.5544578074395034e+133) {
		tmp = c0 * (sqrt(A / V) / sqrt(l));
	} else if ((V * l) <= -9.65057506402844e-82) {
		tmp = c0 * sqrt(A * (1.0 / (V * l)));
	} else if ((V * l) <= 3.6165605275579e-321) {
		tmp = c0 * (sqrt(A / V) / sqrt(l));
	} else if ((V * l) <= 1.7083351686448145e+281) {
		tmp = c0 * (sqrt(A) / sqrt(V * l));
	} else {
		tmp = c0 * sqrt((A / V) * (1.0 / 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.554457807439503e133 or -9.6505750640284402e-82 < (*.f64 V l) < 3.61656e-321

    1. Initial program 32.3

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

      \[\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_binary64_110723.5

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \sqrt[3]{A}}{\ell}}}\]
    7. Applied sqrt-div_binary64_111815.7

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \sqrt[3]{A}}}{\sqrt{\ell}}}\]
    8. Simplified15.4

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

    if -2.554457807439503e133 < (*.f64 V l) < -9.6505750640284402e-82

    1. Initial program 3.7

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

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

    if 3.61656e-321 < (*.f64 V l) < 1.7083351686448145e281

    1. Initial program 10.3

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

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

    if 1.7083351686448145e281 < (*.f64 V l)

    1. Initial program 36.9

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

      \[\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_binary64_110721.1

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}}\]
    5. Using strategy rm
    6. Applied div-inv_binary64_109821.1

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2.5544578074395034 \cdot 10^{+133}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -9.65057506402844 \cdot 10^{-82}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 3.6165605275579 \cdot 10^{-321}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.7083351686448145 \cdot 10^{+281}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V} \cdot \frac{1}{\ell}}\\ \end{array}\]

Reproduce

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