Average Error: 19.1 → 5.7
Time: 5.4s
Precision: binary64
\[ \begin{array}{c}[V, l] = \mathsf{sort}([V, l])\\ \end{array} \]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} t_0 := \frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+218}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-310}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+296}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{{\left(\left|\sqrt[3]{A}\right|\right)}^{2}}{\ell} \cdot \frac{\sqrt[3]{A}}{V}}\\ \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)) c0) (sqrt l))))
   (if (<= (* V l) -2e+218)
     t_0
     (if (<= (* V l) -5e-310)
       (* c0 (/ (sqrt (- A)) (sqrt (* l (- V)))))
       (if (<= (* V l) 1e-310)
         t_0
         (if (<= (* V l) 5e+296)
           (* c0 (/ (sqrt A) (sqrt (* V l))))
           (*
            c0
            (sqrt (* (/ (pow (fabs (cbrt A)) 2.0) l) (/ (cbrt A) V))))))))))
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)) * c0) / sqrt(l);
	double tmp;
	if ((V * l) <= -2e+218) {
		tmp = t_0;
	} else if ((V * l) <= -5e-310) {
		tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
	} else if ((V * l) <= 1e-310) {
		tmp = t_0;
	} else if ((V * l) <= 5e+296) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 * sqrt(((pow(fabs(cbrt(A)), 2.0) / l) * (cbrt(A) / V)));
	}
	return tmp;
}
public static double code(double c0, double A, double V, double l) {
	return c0 * Math.sqrt((A / (V * l)));
}
public static double code(double c0, double A, double V, double l) {
	double t_0 = (Math.sqrt((A / V)) * c0) / Math.sqrt(l);
	double tmp;
	if ((V * l) <= -2e+218) {
		tmp = t_0;
	} else if ((V * l) <= -5e-310) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((l * -V)));
	} else if ((V * l) <= 1e-310) {
		tmp = t_0;
	} else if ((V * l) <= 5e+296) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 * Math.sqrt(((Math.pow(Math.abs(Math.cbrt(A)), 2.0) / l) * (Math.cbrt(A) / V)));
	}
	return tmp;
}
function code(c0, A, V, l)
	return Float64(c0 * sqrt(Float64(A / Float64(V * l))))
end
function code(c0, A, V, l)
	t_0 = Float64(Float64(sqrt(Float64(A / V)) * c0) / sqrt(l))
	tmp = 0.0
	if (Float64(V * l) <= -2e+218)
		tmp = t_0;
	elseif (Float64(V * l) <= -5e-310)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(l * Float64(-V)))));
	elseif (Float64(V * l) <= 1e-310)
		tmp = t_0;
	elseif (Float64(V * l) <= 5e+296)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 * sqrt(Float64(Float64((abs(cbrt(A)) ^ 2.0) / l) * Float64(cbrt(A) / V))));
	end
	return tmp
end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * c0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -2e+218], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -5e-310], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(l * (-V)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e-310], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 5e+296], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(N[Power[N[Abs[N[Power[A, 1/3], $MachinePrecision]], $MachinePrecision], 2.0], $MachinePrecision] / l), $MachinePrecision] * N[(N[Power[A, 1/3], $MachinePrecision] / V), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := \frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+218}:\\
\;\;\;\;t_0\\

\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}\\

\mathbf{elif}\;V \cdot \ell \leq 10^{-310}:\\
\;\;\;\;t_0\\

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

\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{{\left(\left|\sqrt[3]{A}\right|\right)}^{2}}{\ell} \cdot \frac{\sqrt[3]{A}}{V}}\\


\end{array}

Error

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) < -2.00000000000000017e218 or -4.999999999999985e-310 < (*.f64 V l) < 9.999999999999969e-311

    1. Initial program 45.1

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr28.7

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{\frac{A}{V}}{\ell}}} \]
    4. Applied egg-rr18.6

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

    if -2.00000000000000017e218 < (*.f64 V l) < -4.999999999999985e-310

    1. Initial program 9.2

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr0.4

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

    if 9.999999999999969e-311 < (*.f64 V l) < 5.0000000000000001e296

    1. Initial program 10.2

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr0.4

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

    if 5.0000000000000001e296 < (*.f64 V l)

    1. Initial program 38.5

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Applied egg-rr21.7

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+218}:\\ \;\;\;\;\frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-310}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-310}:\\ \;\;\;\;\frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+296}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{{\left(\left|\sqrt[3]{A}\right|\right)}^{2}}{\ell} \cdot \frac{\sqrt[3]{A}}{V}}\\ \end{array} \]

Reproduce

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