?

Average Error: 19.5 → 6.7
Time: 13.7s
Precision: binary64
Cost: 20688

?

\[ \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 -\infty:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-158}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{-V \cdot \ell}}{\sqrt{-A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;\frac{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{A}}}}{\sqrt{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) (- INFINITY))
     t_0
     (if (<= (* V l) -2e-158)
       (/ c0 (/ (sqrt (- (* V l))) (sqrt (- A))))
       (if (<= (* V l) 0.0)
         t_0
         (if (<= (* V l) 1e+302)
           (* c0 (* (pow (* V l) -0.5) (sqrt A)))
           (/ (/ c0 (/ (sqrt l) (sqrt A))) (sqrt 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) <= -((double) INFINITY)) {
		tmp = t_0;
	} else if ((V * l) <= -2e-158) {
		tmp = c0 / (sqrt(-(V * l)) / sqrt(-A));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 1e+302) {
		tmp = c0 * (pow((V * l), -0.5) * sqrt(A));
	} else {
		tmp = (c0 / (sqrt(l) / sqrt(A))) / sqrt(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) <= -Double.POSITIVE_INFINITY) {
		tmp = t_0;
	} else if ((V * l) <= -2e-158) {
		tmp = c0 / (Math.sqrt(-(V * l)) / Math.sqrt(-A));
	} else if ((V * l) <= 0.0) {
		tmp = t_0;
	} else if ((V * l) <= 1e+302) {
		tmp = c0 * (Math.pow((V * l), -0.5) * Math.sqrt(A));
	} else {
		tmp = (c0 / (Math.sqrt(l) / Math.sqrt(A))) / Math.sqrt(V);
	}
	return tmp;
}
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
def code(c0, A, V, l):
	t_0 = (math.sqrt((A / V)) * c0) / math.sqrt(l)
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = t_0
	elif (V * l) <= -2e-158:
		tmp = c0 / (math.sqrt(-(V * l)) / math.sqrt(-A))
	elif (V * l) <= 0.0:
		tmp = t_0
	elif (V * l) <= 1e+302:
		tmp = c0 * (math.pow((V * l), -0.5) * math.sqrt(A))
	else:
		tmp = (c0 / (math.sqrt(l) / math.sqrt(A))) / math.sqrt(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) <= Float64(-Inf))
		tmp = t_0;
	elseif (Float64(V * l) <= -2e-158)
		tmp = Float64(c0 / Float64(sqrt(Float64(-Float64(V * l))) / sqrt(Float64(-A))));
	elseif (Float64(V * l) <= 0.0)
		tmp = t_0;
	elseif (Float64(V * l) <= 1e+302)
		tmp = Float64(c0 * Float64((Float64(V * l) ^ -0.5) * sqrt(A)));
	else
		tmp = Float64(Float64(c0 / Float64(sqrt(l) / sqrt(A))) / sqrt(V));
	end
	return tmp
end
function tmp = code(c0, A, V, l)
	tmp = c0 * sqrt((A / (V * l)));
end
function tmp_2 = code(c0, A, V, l)
	t_0 = (sqrt((A / V)) * c0) / sqrt(l);
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = t_0;
	elseif ((V * l) <= -2e-158)
		tmp = c0 / (sqrt(-(V * l)) / sqrt(-A));
	elseif ((V * l) <= 0.0)
		tmp = t_0;
	elseif ((V * l) <= 1e+302)
		tmp = c0 * (((V * l) ^ -0.5) * sqrt(A));
	else
		tmp = (c0 / (sqrt(l) / sqrt(A))) / sqrt(V);
	end
	tmp_2 = 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], (-Infinity)], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], -2e-158], N[(c0 / N[(N[Sqrt[(-N[(V * l), $MachinePrecision])], $MachinePrecision] / N[Sqrt[(-A)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 1e+302], N[(c0 * N[(N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision] * N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[(c0 / N[(N[Sqrt[l], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[Sqrt[V], $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 -\infty:\\
\;\;\;\;t_0\\

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

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

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

\mathbf{else}:\\
\;\;\;\;\frac{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{A}}}}{\sqrt{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) < -inf.0 or -2.00000000000000013e-158 < (*.f64 V l) < -0.0

    1. Initial program 44.4

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

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

    if -inf.0 < (*.f64 V l) < -2.00000000000000013e-158

    1. Initial program 8.9

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

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

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

      [Start]3.0

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

      associate-/l* [=>]0.4

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

    if -0.0 < (*.f64 V l) < 1.0000000000000001e302

    1. Initial program 10.3

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

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

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

    if 1.0000000000000001e302 < (*.f64 V l)

    1. Initial program 40.1

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

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

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

      [Start]34.5

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

      associate-/l/ [=>]34.5

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

      associate-/r* [=>]34.5

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

      associate-/l* [=>]33.4

      \[ \frac{\color{blue}{\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{A}}}}}{\sqrt{V}} \]
  3. Recombined 4 regimes into one program.
  4. Final simplification6.7

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

Alternatives

Alternative 1
Error9.2
Cost14352
\[\begin{array}{l} t_0 := \frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-156}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 2
Error7.3
Cost14352
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+260}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-158}:\\ \;\;\;\;\sqrt{-A} \cdot \frac{c0}{\sqrt{-V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 3
Error6.7
Cost14352
\[\begin{array}{l} t_0 := \frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-158}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{-V \cdot \ell}}{\sqrt{-A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 4
Error8.7
Cost14288
\[\begin{array}{l} t_0 := \frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-156}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 5
Error8.6
Cost14288
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+123}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-156}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 6
Error9.2
Cost14288
\[\begin{array}{l} t_0 := \frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+123}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-156}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 7
Error10.2
Cost14092
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-156}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{\sqrt{\frac{A}{V}} \cdot c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \left({\left(V \cdot \ell\right)}^{-0.5} \cdot \sqrt{A}\right)\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 8
Error13.9
Cost13768
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+302}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 9
Error15.4
Cost7753
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 2 \cdot 10^{+305}\right):\\ \;\;\;\;\sqrt{\frac{A \cdot c0}{V} \cdot \frac{c0}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \end{array} \]
Alternative 10
Error15.5
Cost7752
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;t_0 \leq 10^{+306}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 11
Error16.4
Cost7752
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;\sqrt{\frac{c0}{\frac{V}{c0}} \cdot \frac{A}{\ell}}\\ \mathbf{elif}\;t_0 \leq 10^{+306}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0}{\frac{\ell}{c0}}}\\ \end{array} \]
Alternative 12
Error14.7
Cost7625
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 2 \cdot 10^{+305}\right):\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \end{array} \]
Alternative 13
Error14.4
Cost7624
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;t_0 \leq 10^{+306}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \]
Alternative 14
Error14.5
Cost7624
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;t_0 \leq 10^{+306}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \]
Alternative 15
Error19.5
Cost6848
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

Error

Reproduce?

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