Average Error: 19.5 → 8.0
Time: 6.5s
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 -5.956236208390198 \cdot 10^{+176}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -1.2216663093192363 \cdot 10^{-165}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 1.6189194423470151 \cdot 10^{+298}:\\ \;\;\;\;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 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{if}\;V \cdot \ell \leq -5.956236208390198 \cdot 10^{+176}:\\
\;\;\;\;t_0\\

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

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

\mathbf{elif}\;V \cdot \ell \leq 1.6189194423470151 \cdot 10^{+298}:\\
\;\;\;\;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 (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
   (if (<= (* V l) -5.956236208390198e+176)
     t_0
     (if (<= (* V l) -1.2216663093192363e-165)
       (* c0 (sqrt (/ A (* V l))))
       (if (<= (* V l) 0.0)
         t_0
         (if (<= (* V l) 1.6189194423470151e+298)
           (* 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 = c0 * (sqrt(A / V) / sqrt(l));
	double tmp;
	if ((V * l) <= -5.956236208390198e+176) {
		tmp = t_0;
	} else if ((V * l) <= -1.2216663093192363e-165) {
		tmp = c0 * sqrt(A / (V * l));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 1.6189194423470151e+298) {
		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 4 regimes
  2. if (*.f64 V l) < -5.9562362083901976e176 or -1.2216663093192363e-165 < (*.f64 V l) < -0.0

    1. Initial program 36.7

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied add-cube-cbrt_binary6436.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_binary6425.4

      \[\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/_binary6425.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_binary6416.1

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

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

    if -5.9562362083901976e176 < (*.f64 V l) < -1.2216663093192363e-165

    1. Initial program 6.0

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied add-cube-cbrt_binary646.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_binary6412.1

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}} \]
    4. Applied pow1_binary6412.1

      \[\leadsto c0 \cdot \color{blue}{{\left(\sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}\right)}^{1}} \]
    5. Applied pow1_binary6412.1

      \[\leadsto \color{blue}{{c0}^{1}} \cdot {\left(\sqrt{\frac{\sqrt[3]{A} \cdot \sqrt[3]{A}}{V} \cdot \frac{\sqrt[3]{A}}{\ell}}\right)}^{1} \]
    6. Applied pow-prod-down_binary6412.1

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

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

    if -0.0 < (*.f64 V l) < 1.61891944234701512e298

    1. Initial program 11.8

      \[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.61891944234701512e298 < (*.f64 V l)

    1. Initial program 39.8

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5.956236208390198 \cdot 10^{+176}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1.2216663093192363 \cdot 10^{-165}:\\ \;\;\;\;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{elif}\;V \cdot \ell \leq 1.6189194423470151 \cdot 10^{+298}:\\ \;\;\;\;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 2022121 
(FPCore (c0 A V l)
  :name "Henrywood and Agarwal, Equation (3)"
  :precision binary64
  (* c0 (sqrt (/ A (* V l)))))