?

Average Error: 19.2 → 6.6
Time: 14.6s
Precision: binary64
Cost: 20036

?

\[ \begin{array}{c}[V, l] = \mathsf{sort}([V, l])\\ \end{array} \]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} t_0 := \sqrt{-V}\\ \mathbf{if}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell} \cdot t_0}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+295}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\frac{1}{t_0} \cdot \sqrt{\frac{A}{-\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 (sqrt (- V))))
   (if (<= (* V l) 0.0)
     (* c0 (/ (sqrt (- A)) (* (sqrt l) t_0)))
     (if (<= (* V l) 1e+295)
       (/ c0 (/ (sqrt (* V l)) (sqrt A)))
       (* c0 (* (/ 1.0 t_0) (sqrt (/ 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 = sqrt(-V);
	double tmp;
	if ((V * l) <= 0.0) {
		tmp = c0 * (sqrt(-A) / (sqrt(l) * t_0));
	} else if ((V * l) <= 1e+295) {
		tmp = c0 / (sqrt((V * l)) / sqrt(A));
	} else {
		tmp = c0 * ((1.0 / t_0) * sqrt((A / -l)));
	}
	return tmp;
}
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    code = c0 * sqrt((a / (v * l)))
end function
real(8) function code(c0, a, v, l)
    real(8), intent (in) :: c0
    real(8), intent (in) :: a
    real(8), intent (in) :: v
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: tmp
    t_0 = sqrt(-v)
    if ((v * l) <= 0.0d0) then
        tmp = c0 * (sqrt(-a) / (sqrt(l) * t_0))
    else if ((v * l) <= 1d+295) then
        tmp = c0 / (sqrt((v * l)) / sqrt(a))
    else
        tmp = c0 * ((1.0d0 / t_0) * sqrt((a / -l)))
    end if
    code = tmp
end function
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(-V);
	double tmp;
	if ((V * l) <= 0.0) {
		tmp = c0 * (Math.sqrt(-A) / (Math.sqrt(l) * t_0));
	} else if ((V * l) <= 1e+295) {
		tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
	} else {
		tmp = c0 * ((1.0 / t_0) * Math.sqrt((A / -l)));
	}
	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(-V)
	tmp = 0
	if (V * l) <= 0.0:
		tmp = c0 * (math.sqrt(-A) / (math.sqrt(l) * t_0))
	elif (V * l) <= 1e+295:
		tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A))
	else:
		tmp = c0 * ((1.0 / t_0) * math.sqrt((A / -l)))
	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 = sqrt(Float64(-V))
	tmp = 0.0
	if (Float64(V * l) <= 0.0)
		tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / Float64(sqrt(l) * t_0)));
	elseif (Float64(V * l) <= 1e+295)
		tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A)));
	else
		tmp = Float64(c0 * Float64(Float64(1.0 / t_0) * sqrt(Float64(A / Float64(-l)))));
	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(-V);
	tmp = 0.0;
	if ((V * l) <= 0.0)
		tmp = c0 * (sqrt(-A) / (sqrt(l) * t_0));
	elseif ((V * l) <= 1e+295)
		tmp = c0 / (sqrt((V * l)) / sqrt(A));
	else
		tmp = c0 * ((1.0 / t_0) * sqrt((A / -l)));
	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[Sqrt[(-V)], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[(N[Sqrt[l], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+295], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[(1.0 / t$95$0), $MachinePrecision] * N[Sqrt[N[(A / (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := \sqrt{-V}\\
\mathbf{if}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell} \cdot t_0}\\

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

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


\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) < -0.0

    1. Initial program 22.4

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

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

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

    if -0.0 < (*.f64 V l) < 9.9999999999999998e294

    1. Initial program 10.4

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

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

    if 9.9999999999999998e294 < (*.f64 V l)

    1. Initial program 38.7

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

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

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

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

Alternatives

Alternative 1
Error7.9
Cost14544
\[\begin{array}{l} t_0 := \sqrt{-V}\\ t_1 := \sqrt{\frac{A}{-\ell}}\\ t_2 := c0 \cdot \frac{t_1}{t_0}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+189}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-200}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-318}:\\ \;\;\;\;t_2\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+295}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \left(\frac{1}{t_0} \cdot t_1\right)\\ \end{array} \]
Alternative 2
Error9.6
Cost14417
\[\begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+101}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-219}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-318} \lor \neg \left(V \cdot \ell \leq 10^{+295}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\ \end{array} \]
Alternative 3
Error8.0
Cost14417
\[\begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+204}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-219}:\\ \;\;\;\;\sqrt{-A} \cdot \frac{c0}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-318} \lor \neg \left(V \cdot \ell \leq 10^{+295}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\ \end{array} \]
Alternative 4
Error7.9
Cost14417
\[\begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{\frac{A}{-\ell}}}{\sqrt{-V}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+189}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-200}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-318} \lor \neg \left(V \cdot \ell \leq 10^{+295}\right):\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\ \end{array} \]
Alternative 5
Error10.9
Cost14288
\[\begin{array}{l} t_0 := \sqrt{V \cdot \frac{\ell}{A}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-198}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-318}:\\ \;\;\;\;\frac{1}{\frac{t_0}{c0}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+295}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{t_0}\\ \end{array} \]
Alternative 6
Error10.3
Cost14288
\[\begin{array}{l} t_0 := \sqrt{V \cdot \frac{\ell}{A}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+65}:\\ \;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-198}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-318}:\\ \;\;\;\;\frac{1}{\frac{t_0}{c0}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+295}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{t_0}\\ \end{array} \]
Alternative 7
Error10.0
Cost14288
\[\begin{array}{l} t_0 := \sqrt{V \cdot \frac{\ell}{A}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+65}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-198}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-318}:\\ \;\;\;\;\frac{1}{\frac{t_0}{c0}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+295}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{t_0}\\ \end{array} \]
Alternative 8
Error10.0
Cost14288
\[\begin{array}{l} t_0 := \sqrt{V \cdot \frac{\ell}{A}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+65}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-198}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-318}:\\ \;\;\;\;\frac{1}{\frac{t_0}{c0}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+295}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{t_0}\\ \end{array} \]
Alternative 9
Error14.7
Cost8017
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-198} \lor \neg \left(V \cdot \ell \leq 2 \cdot 10^{-311}\right) \land V \cdot \ell \leq 2 \cdot 10^{+154}:\\ \;\;\;\;c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 10
Error14.7
Cost8016
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{A \cdot \frac{1}{V \cdot \ell}}\\ t_1 := \sqrt{V \cdot \frac{\ell}{A}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-198}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-279}:\\ \;\;\;\;\frac{1}{\frac{t_1}{c0}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+154}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{t_1}\\ \end{array} \]
Alternative 11
Error14.7
Cost7890
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty \lor \neg \left(V \cdot \ell \leq -1 \cdot 10^{-237}\right) \land \left(V \cdot \ell \leq 2 \cdot 10^{-311} \lor \neg \left(V \cdot \ell \leq 2 \cdot 10^{+154}\right)\right):\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \end{array} \]
Alternative 12
Error14.7
Cost7889
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-237} \lor \neg \left(V \cdot \ell \leq 2 \cdot 10^{-311}\right) \land V \cdot \ell \leq 2 \cdot 10^{+154}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
Alternative 13
Error14.7
Cost7889
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-198} \lor \neg \left(V \cdot \ell \leq 2 \cdot 10^{-311}\right) \land V \cdot \ell \leq 2 \cdot 10^{+139}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 14
Error14.7
Cost7889
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-198} \lor \neg \left(V \cdot \ell \leq 2 \cdot 10^{-311}\right) \land V \cdot \ell \leq 2 \cdot 10^{+154}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 15
Error19.2
Cost6848
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

Error

Reproduce?

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