Average Error: 19.3 → 9.8
Time: 9.9s
Precision: binary64
\[[V, l]=\mathsf{sort}([V, l])\]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -4.448709412619901 \cdot 10^{+182}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -3.9825286554761743 \cdot 10^{-56}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)\\ \end{array} \]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{if}\;V \cdot \ell \leq -4.448709412619901 \cdot 10^{+182}:\\
\;\;\;\;t_0\\

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

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)\\


\end{array}
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
 :precision binary64
 (let* ((t_0 (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
   (if (<= (* V l) -4.448709412619901e+182)
     t_0
     (if (<= (* V l) -3.9825286554761743e-56)
       (* c0 (sqrt (/ A (* V l))))
       (if (<= (* V l) 0.0) t_0 (* c0 (* (sqrt A) (sqrt (/ 1.0 (* 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 t_0 = c0 * (sqrt(A / V) / sqrt(l));
	double tmp;
	if ((V * l) <= -4.448709412619901e+182) {
		tmp = t_0;
	} else if ((V * l) <= -3.9825286554761743e-56) {
		tmp = c0 * sqrt(A / (V * l));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else {
		tmp = c0 * (sqrt(A) * sqrt(1.0 / (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) < -4.44870941261990077e182 or -3.98252865547617431e-56 < (*.f64 V l) < -0.0

    1. Initial program 31.3

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

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

      \[\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/_binary6423.7

      \[\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_binary6415.8

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

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

    if -4.44870941261990077e182 < (*.f64 V l) < -3.98252865547617431e-56

    1. Initial program 5.3

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

      \[\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 *-un-lft-identity_binary6413.8

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\left(1 \cdot \frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V}\right)} \cdot \frac{\sqrt[3]{A}}{\ell}} \]
    5. Applied associate-*l*_binary6413.8

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

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

    if -0.0 < (*.f64 V l)

    1. Initial program 15.7

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{A \cdot \frac{1}{V \cdot \ell}}} \]
    3. Applied sqrt-prod_binary647.2

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -4.448709412619901 \cdot 10^{+182}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -3.9825286554761743 \cdot 10^{-56}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{1}{V \cdot \ell}}\right)\\ \end{array} \]

Reproduce

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