Average Error: 18.5 → 13.7
Time: 5.7s
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.403333487912658 \cdot 10^{-111}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2.5967983781006628 \cdot 10^{-263}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V}{\frac{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.403333487912658 \cdot 10^{-111}:\\
\;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\

\mathbf{elif}\;V \cdot \ell \leq 2.5967983781006628 \cdot 10^{-263}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V}{\frac{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.403333487912658e-111)
   (* c0 (sqrt (* A (/ 1.0 (* V l)))))
   (if (<= (* V l) 2.5967983781006628e-263)
     (* c0 (sqrt (/ 1.0 (/ V (/ 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.403333487912658e-111) {
		tmp = c0 * sqrt((A * (1.0 / (V * l))));
	} else if ((V * l) <= 2.5967983781006628e-263) {
		tmp = c0 * sqrt((1.0 / (V / (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 3 regimes
  2. if (*.f64 V l) < -2.4033334879126581e-111

    1. Initial program 14.6

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied div-inv_binary6414.6

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

    if -2.4033334879126581e-111 < (*.f64 V l) < 2.5967983781006628e-263

    1. Initial program 36.0

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied clear-num_binary6436.0

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

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

    if 2.5967983781006628e-263 < (*.f64 V l)

    1. Initial program 13.6

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied sqrt-div_binary647.0

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2.403333487912658 \cdot 10^{-111}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2.5967983781006628 \cdot 10^{-263}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]

Reproduce

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