Average Error: 18.9 → 5.3
Time: 12.1s
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 -5 \cdot 10^{-241}:\\ \;\;\;\;c0 \cdot \frac{\frac{\sqrt{-A}}{t_0}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{t_0}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \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) -5e-241)
     (* c0 (/ (/ (sqrt (- A)) t_0) (sqrt l)))
     (if (<= (* V l) 0.0)
       (* c0 (/ (sqrt (- (/ A l))) t_0))
       (if (<= (* V l) 1e+289)
         (* c0 (/ (sqrt A) (sqrt (* V l))))
         (/ c0 (sqrt (* V (/ l A)))))))))
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) <= -5e-241) {
		tmp = c0 * ((sqrt(-A) / t_0) / sqrt(l));
	} else if ((V * l) <= 0.0) {
		tmp = c0 * (sqrt(-(A / l)) / t_0);
	} else if ((V * l) <= 1e+289) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 / sqrt((V * (l / A)));
	}
	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) <= (-5d-241)) then
        tmp = c0 * ((sqrt(-a) / t_0) / sqrt(l))
    else if ((v * l) <= 0.0d0) then
        tmp = c0 * (sqrt(-(a / l)) / t_0)
    else if ((v * l) <= 1d+289) then
        tmp = c0 * (sqrt(a) / sqrt((v * l)))
    else
        tmp = c0 / sqrt((v * (l / a)))
    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) <= -5e-241) {
		tmp = c0 * ((Math.sqrt(-A) / t_0) / Math.sqrt(l));
	} else if ((V * l) <= 0.0) {
		tmp = c0 * (Math.sqrt(-(A / l)) / t_0);
	} else if ((V * l) <= 1e+289) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 / Math.sqrt((V * (l / A)));
	}
	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) <= -5e-241:
		tmp = c0 * ((math.sqrt(-A) / t_0) / math.sqrt(l))
	elif (V * l) <= 0.0:
		tmp = c0 * (math.sqrt(-(A / l)) / t_0)
	elif (V * l) <= 1e+289:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 / math.sqrt((V * (l / A)))
	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) <= -5e-241)
		tmp = Float64(c0 * Float64(Float64(sqrt(Float64(-A)) / t_0) / sqrt(l)));
	elseif (Float64(V * l) <= 0.0)
		tmp = Float64(c0 * Float64(sqrt(Float64(-Float64(A / l))) / t_0));
	elseif (Float64(V * l) <= 1e+289)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A))));
	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) <= -5e-241)
		tmp = c0 * ((sqrt(-A) / t_0) / sqrt(l));
	elseif ((V * l) <= 0.0)
		tmp = c0 * (sqrt(-(A / l)) / t_0);
	elseif ((V * l) <= 1e+289)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 / sqrt((V * (l / A)));
	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], -5e-241], N[(c0 * N[(N[(N[Sqrt[(-A)], $MachinePrecision] / t$95$0), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[(-N[(A / l), $MachinePrecision])], $MachinePrecision] / t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+289], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $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 -5 \cdot 10^{-241}:\\
\;\;\;\;c0 \cdot \frac{\frac{\sqrt{-A}}{t_0}}{\sqrt{\ell}}\\

\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{t_0}\\

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

\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\


\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) < -4.9999999999999998e-241

    1. Initial program 14.0

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

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

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

    if -4.9999999999999998e-241 < (*.f64 V l) < -0.0

    1. Initial program 54.5

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

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

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

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

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

    1. Initial program 10.4

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

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

    if 1.0000000000000001e289 < (*.f64 V l)

    1. Initial program 39.4

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

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

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}} \]
    4. Applied egg-rr23.7

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{-241}:\\ \;\;\;\;c0 \cdot \frac{\frac{\sqrt{-A}}{\sqrt{-V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]

Alternatives

Alternative 1
Error14.9
Cost34640
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+303}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;t_0 \leq -5 \cdot 10^{-279}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_0 \leq 10^{-244}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+298}:\\ \;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0 \cdot c0}{\ell}}\\ \end{array} \]
Alternative 2
Error14.7
Cost34576
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ t_1 := \frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+303}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;t_0 \leq -5 \cdot 10^{-279}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_0 \leq 10^{-244}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 10^{+298}:\\ \;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 3
Error14.6
Cost34512
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ t_1 := \frac{c0}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \mathbf{if}\;t_0 \leq -5 \cdot 10^{+303}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;t_0 \leq -5 \cdot 10^{-279}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_0 \leq 10^{-244}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_0 \leq 10^{+298}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 4
Error5.3
Cost20036
\[\begin{array}{l} t_0 := \sqrt{-V}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{-241}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \frac{t_0}{\sqrt{-A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{t_0}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 5
Error9.2
Cost14288
\[\begin{array}{l} t_0 := \sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+132}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -2 \cdot 10^{-177}:\\ \;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-317}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 6
Error9.0
Cost14288
\[\begin{array}{l} t_0 := \frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+142}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-218}:\\ \;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-317}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 7
Error8.2
Cost14288
\[\begin{array}{l} t_0 := \frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+142}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-218}:\\ \;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-317}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 8
Error8.1
Cost14288
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+142}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-218}:\\ \;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-317}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 9
Error7.9
Cost14288
\[\begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}\\ \mathbf{if}\;V \cdot \ell \leq -4 \cdot 10^{+151}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-129}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 10
Error12.5
Cost14028
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-279}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.2 \cdot 10^{-317}:\\ \;\;\;\;c0 \cdot \frac{1}{\sqrt{\frac{\ell}{\frac{A}{V}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 11
Error7.7
Cost14028
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{-241}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{\sqrt{-\frac{A}{\ell}}}{\sqrt{-V}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+289}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \end{array} \]
Alternative 12
Error16.3
Cost7628
\[\begin{array}{l} t_0 := \frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ t_1 := \frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-298}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-289}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+26}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 13
Error16.3
Cost7628
\[\begin{array}{l} t_0 := \frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}}\\ \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-298}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-289}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+26}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \end{array} \]
Alternative 14
Error18.8
Cost6848
\[\frac{c0}{\sqrt{\frac{V \cdot \ell}{A}}} \]

Error

Reproduce

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