Average Error: 19.0 → 10.9
Time: 5.8s
Precision: binary64
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -7.19110256370914 \cdot 10^{+197}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq -2.0654560949368145 \cdot 10^{-165}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.0038216364336875 \cdot 10^{+283}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \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 \leq -7.19110256370914 \cdot 10^{+197}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V \cdot \frac{\ell}{A}}}\\

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

\mathbf{elif}\;V \cdot \ell \leq -0:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\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) -7.19110256370914e+197)
   (* c0 (sqrt (/ 1.0 (* V (/ l A)))))
   (if (<= (* V l) -2.0654560949368145e-165)
     (* c0 (sqrt (* A (/ 1.0 (* V l)))))
     (if (<= (* V l) -0.0)
       (* c0 (sqrt (* (/ 1.0 V) (/ A l))))
       (if (<= (* V l) 1.0038216364336875e+283)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (* c0 (sqrt (/ (/ A V) l))))))))
double code(double c0, double A, double V, double l) {
	return ((double) (c0 * ((double) sqrt((A / ((double) (V * l)))))));
}
double code(double c0, double A, double V, double l) {
	double tmp;
	if ((((double) (V * l)) <= -7.19110256370914e+197)) {
		tmp = ((double) (c0 * ((double) sqrt((1.0 / ((double) (V * (l / A))))))));
	} else {
		double tmp_1;
		if ((((double) (V * l)) <= -2.0654560949368145e-165)) {
			tmp_1 = ((double) (c0 * ((double) sqrt(((double) (A * (1.0 / ((double) (V * l)))))))));
		} else {
			double tmp_2;
			if ((((double) (V * l)) <= -0.0)) {
				tmp_2 = ((double) (c0 * ((double) sqrt(((double) ((1.0 / V) * (A / l)))))));
			} else {
				double tmp_3;
				if ((((double) (V * l)) <= 1.0038216364336875e+283)) {
					tmp_3 = ((double) (c0 * (((double) sqrt(A)) / ((double) sqrt(((double) (V * l)))))));
				} else {
					tmp_3 = ((double) (c0 * ((double) sqrt(((A / V) / l)))));
				}
				tmp_2 = tmp_3;
			}
			tmp_1 = tmp_2;
		}
		tmp = tmp_1;
	}
	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 5 regimes
  2. if (* V l) < -7.19110256370913983e197

    1. Initial program Error: 29.0 bits

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied clear-numError: 29.4 bits

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{1}{\frac{V \cdot \ell}{A}}}}\]
    4. SimplifiedError: 19.7 bits

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

    if -7.19110256370913983e197 < (* V l) < -2.0654560949368145e-165

    1. Initial program Error: 6.0 bits

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied div-invError: 6.0 bits

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

    if -2.0654560949368145e-165 < (* V l) < -0.0

    1. Initial program Error: 44.3 bits

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\]
    2. Using strategy rm
    3. Applied *-un-lft-identityError: 44.3 bits

      \[\leadsto c0 \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}}\]
    4. Applied times-fracError: 31.7 bits

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

    if -0.0 < (* V l) < 1.0038216364336875e283

    1. Initial program Error: 10.2 bits

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

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

    if 1.0038216364336875e283 < (* V l)

    1. Initial program Error: 39.0 bits

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}}\]
  3. Recombined 5 regimes into one program.
  4. Final simplificationError: 10.9 bits

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -7.19110256370914 \cdot 10^{+197}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq -2.0654560949368145 \cdot 10^{-165}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.0038216364336875 \cdot 10^{+283}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array}\]

Reproduce

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