Average Error: 18.8 → 3.5
Time: 14.9s
Precision: binary64
Cost: 20752
\[ \begin{array}{c}[V, l] = \mathsf{sort}([V, l])\\ \end{array} \]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} t_0 := c0 \cdot {\left(\sqrt[3]{\frac{\ell}{A}} \cdot \sqrt[3]{V}\right)}^{-1.5}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-274}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+294}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \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 (pow (* (cbrt (/ l A)) (cbrt V)) -1.5))))
   (if (<= (* V l) (- INFINITY))
     t_0
     (if (<= (* V l) -2e-274)
       (* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
       (if (<= (* V l) 0.0)
         t_0
         (if (<= (* V l) 5e+294)
           (* c0 (* (pow (* V l) -0.5) (sqrt A)))
           t_0))))))
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 * pow((cbrt((l / A)) * cbrt(V)), -1.5);
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = t_0;
	} else if ((V * l) <= -2e-274) {
		tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 5e+294) {
		tmp = c0 * (pow((V * l), -0.5) * sqrt(A));
	} else {
		tmp = t_0;
	}
	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 = c0 * Math.pow((Math.cbrt((l / A)) * Math.cbrt(V)), -1.5);
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = t_0;
	} else if ((V * l) <= -2e-274) {
		tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 5e+294) {
		tmp = c0 * (Math.pow((V * l), -0.5) * Math.sqrt(A));
	} else {
		tmp = t_0;
	}
	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(c0 * (Float64(cbrt(Float64(l / A)) * cbrt(V)) ^ -1.5))
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = t_0;
	elseif (Float64(V * l) <= -2e-274)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l)))));
	elseif (Float64(V * l) <= 0.0)
		tmp = t_0;
	elseif (Float64(V * l) <= 5e+294)
		tmp = Float64(c0 * Float64((Float64(V * l) ^ -0.5) * sqrt(A)));
	else
		tmp = t_0;
	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[(c0 * N[Power[N[(N[Power[N[(l / A), $MachinePrecision], 1/3], $MachinePrecision] * N[Power[V, 1/3], $MachinePrecision]), $MachinePrecision], -1.5], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -2e-274], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 5e+294], N[(c0 * N[(N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := c0 \cdot {\left(\sqrt[3]{\frac{\ell}{A}} \cdot \sqrt[3]{V}\right)}^{-1.5}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;t_0\\

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

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

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

\mathbf{else}:\\
\;\;\;\;t_0\\


\end{array}

Error

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) < -inf.0 or -1.99999999999999993e-274 < (*.f64 V l) < -0.0 or 4.9999999999999999e294 < (*.f64 V l)

    1. Initial program 47.0

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

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

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

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

    if -inf.0 < (*.f64 V l) < -1.99999999999999993e-274

    1. Initial program 9.3

      \[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 -0.0 < (*.f64 V l) < 4.9999999999999999e294

    1. Initial program 9.9

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

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

      \[\leadsto c0 \cdot \color{blue}{\left({\left(\ell \cdot V\right)}^{-0.5} \cdot \sqrt{A}\right)} \]
  3. Recombined 3 regimes into one program.
  4. Final simplification3.5

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot {\left(\sqrt[3]{\frac{\ell}{A}} \cdot \sqrt[3]{V}\right)}^{-1.5}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-274}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot {\left(\sqrt[3]{\frac{\ell}{A}} \cdot \sqrt[3]{V}\right)}^{-1.5}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+294}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot {\left(\sqrt[3]{\frac{\ell}{A}} \cdot \sqrt[3]{V}\right)}^{-1.5}\\ \end{array} \]

Alternatives

Alternative 1
Error4.8
Cost20232
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{1}{\frac{\sqrt{\ell}}{\frac{\sqrt{-A}}{\sqrt{-V}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+294}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot {\left(\sqrt[3]{\frac{\ell}{A}} \cdot \sqrt[3]{V}\right)}^{-1.5}\\ \end{array} \]
Alternative 2
Error4.7
Cost20232
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \left(\frac{\sqrt{-A}}{\sqrt{-V}} \cdot {\ell}^{-0.5}\right)\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+294}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot {\left(\sqrt[3]{\frac{\ell}{A}} \cdot \sqrt[3]{V}\right)}^{-1.5}\\ \end{array} \]
Alternative 3
Error9.8
Cost14092
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+136}:\\ \;\;\;\;\frac{\frac{c0}{\sqrt{\ell}}}{\sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-15}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \end{array} \]
Alternative 4
Error9.5
Cost14092
\[\begin{array}{l} t_0 := \sqrt{\frac{A}{V}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+154}:\\ \;\;\;\;c0 \cdot \left({\ell}^{-0.5} \cdot t_0\right)\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-15}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{t_0}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \end{array} \]
Alternative 5
Error6.8
Cost14092
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;\frac{\frac{c0}{\sqrt{\ell}}}{\sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-228}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \end{array} \]
Alternative 6
Error10.4
Cost14028
\[\begin{array}{l} t_0 := \frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+136}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-15}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\ \end{array} \]
Alternative 7
Error10.3
Cost14028
\[\begin{array}{l} t_0 := \sqrt{\frac{A}{V}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+154}:\\ \;\;\;\;c0 \cdot \frac{t_0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-15}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{t_0}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\ \end{array} \]
Alternative 8
Error10.7
Cost14028
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+136}:\\ \;\;\;\;\frac{\frac{c0}{\sqrt{\ell}}}{\sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-15}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\ \end{array} \]
Alternative 9
Error9.8
Cost14028
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+136}:\\ \;\;\;\;\frac{\frac{c0}{\sqrt{\ell}}}{\sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-15}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]
Alternative 10
Error11.3
Cost14024
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ t_1 := \frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 10^{+304}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 11
Error14.2
Cost7624
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 4 \cdot 10^{-312}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 10^{+266}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 12
Error14.2
Cost7624
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot {\left(\frac{V}{\frac{A}{\ell}}\right)}^{-0.5}\\ \mathbf{elif}\;t_0 \leq 10^{+266}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 13
Error18.4
Cost6980
\[\begin{array}{l} \mathbf{if}\;\ell \leq 10^{-114}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \end{array} \]
Alternative 14
Error18.7
Cost6848
\[\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}} \]

Error

Reproduce

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