Average Error: 18.8 → 8.7
Time: 11.2s
Precision: binary64
\[[V, l]=\mathsf{sort}([V, l])\]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} t_0 := \sqrt{\frac{A}{V}}\\ \mathbf{if}\;V \cdot \ell \leq -3.122755575920144 \cdot 10^{+254}:\\ \;\;\;\;\frac{c0 \cdot t_0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1.1772842213791325 \cdot 10^{-160}:\\ \;\;\;\;\begin{array}{l} t_1 := \sqrt{\frac{A}{V \cdot \ell}}\\ c0 \cdot \sqrt{t_1 \cdot t_1} \end{array}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{t_0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.5592629997751725 \cdot 10^{+252}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \end{array} \]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V}}\\
\mathbf{if}\;V \cdot \ell \leq -3.122755575920144 \cdot 10^{+254}:\\
\;\;\;\;\frac{c0 \cdot t_0}{\sqrt{\ell}}\\

\mathbf{elif}\;V \cdot \ell \leq -1.1772842213791325 \cdot 10^{-160}:\\
\;\;\;\;\begin{array}{l}
t_1 := \sqrt{\frac{A}{V \cdot \ell}}\\
c0 \cdot \sqrt{t_1 \cdot t_1}
\end{array}\\

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{t_0}{\sqrt{\ell}}\\

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

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


\end{array}
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (sqrt (/ A V))))
   (if (<= (* V l) -3.122755575920144e+254)
     (/ (* c0 t_0) (sqrt l))
     (if (<= (* V l) -1.1772842213791325e-160)
       (let* ((t_1 (sqrt (/ A (* V l))))) (* c0 (sqrt (* t_1 t_1))))
       (if (<= (* V l) 0.0)
         (* c0 (/ t_0 (sqrt l)))
         (if (<= (* V l) 1.5592629997751725e+252)
           (* c0 (/ (sqrt A) (sqrt (* V l))))
           (* c0 (sqrt (* (/ 1.0 V) (/ A 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 t_0 = sqrt(A / V);
	double tmp;
	if ((V * l) <= -3.122755575920144e+254) {
		tmp = (c0 * t_0) / sqrt(l);
	} else if ((V * l) <= -1.1772842213791325e-160) {
		double t_1 = sqrt(A / (V * l));
		tmp = c0 * sqrt(t_1 * t_1);
	} else if ((V * l) <= 0.0) {
		tmp = c0 * (t_0 / sqrt(l));
	} else if ((V * l) <= 1.5592629997751725e+252) {
		tmp = c0 * (sqrt(A) / sqrt(V * l));
	} else {
		tmp = c0 * sqrt((1.0 / V) * (A / 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 5 regimes
  2. if (*.f64 V l) < -3.1227555759201441e254

    1. Initial program 34.2

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied add-cube-cbrt_binary6434.2

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}} \]
    4. Applied associate-*r/_binary6422.3

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

      \[\leadsto c0 \cdot \color{blue}{\frac{\sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \sqrt[3]{A}}}{\sqrt{\ell}}} \]
    6. Applied associate-*r/_binary6411.3

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

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

    if -3.1227555759201441e254 < (*.f64 V l) < -1.1772842213791325e-160

    1. Initial program 7.4

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied add-cube-cbrt_binary647.9

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}} \]
    4. Applied add-sqr-sqrt_binary6413.8

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}} \cdot \sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}}} \]
    5. Simplified13.6

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

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

    if -1.1772842213791325e-160 < (*.f64 V l) < 0.0

    1. Initial program 41.9

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied add-cube-cbrt_binary6442.1

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}} \]
    4. Applied associate-*r/_binary6429.8

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

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

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

    if 0.0 < (*.f64 V l) < 1.5592629997751725e252

    1. Initial program 9.7

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

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

    if 1.5592629997751725e252 < (*.f64 V l)

    1. Initial program 33.6

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied *-un-lft-identity_binary6433.6

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

      \[\leadsto \color{blue}{\left(c0 \cdot 1\right) \cdot \sqrt{\frac{A}{V \cdot \ell}}} \]
    4. Applied *-un-lft-identity_binary6433.6

      \[\leadsto \left(c0 \cdot 1\right) \cdot \sqrt{\frac{\color{blue}{1 \cdot A}}{V \cdot \ell}} \]
    5. Applied times-frac_binary6419.7

      \[\leadsto \left(c0 \cdot 1\right) \cdot \sqrt{\color{blue}{\frac{1}{V} \cdot \frac{A}{\ell}}} \]
  3. Recombined 5 regimes into one program.
  4. Final simplification8.7

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -3.122755575920144 \cdot 10^{+254}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1.1772842213791325 \cdot 10^{-160}:\\ \;\;\;\;c0 \cdot \sqrt{\sqrt{\frac{A}{V \cdot \ell}} \cdot \sqrt{\frac{A}{V \cdot \ell}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.5592629997751725 \cdot 10^{+252}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\ \end{array} \]

Reproduce

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