?

Average Error: 19.1 → 14.8
Time: 13.0s
Precision: binary64
Cost: 7888

?

\[ \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 \sqrt{\frac{A}{V \cdot \ell}}\\ t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-204}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-271}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+147}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \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 (sqrt (/ A (* V l))))) (t_1 (* c0 (sqrt (/ (/ A V) l)))))
   (if (<= (* V l) (- INFINITY))
     t_1
     (if (<= (* V l) -5e-204)
       t_0
       (if (<= (* V l) 1e-271) t_1 (if (<= (* V l) 5e+147) t_0 t_1))))))
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 * sqrt((A / (V * l)));
	double t_1 = c0 * sqrt(((A / V) / l));
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = t_1;
	} else if ((V * l) <= -5e-204) {
		tmp = t_0;
	} else if ((V * l) <= 1e-271) {
		tmp = t_1;
	} else if ((V * l) <= 5e+147) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	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.sqrt((A / (V * l)));
	double t_1 = c0 * Math.sqrt(((A / V) / l));
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = t_1;
	} else if ((V * l) <= -5e-204) {
		tmp = t_0;
	} else if ((V * l) <= 1e-271) {
		tmp = t_1;
	} else if ((V * l) <= 5e+147) {
		tmp = t_0;
	} else {
		tmp = t_1;
	}
	return tmp;
}
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
def code(c0, A, V, l):
	t_0 = c0 * math.sqrt((A / (V * l)))
	t_1 = c0 * math.sqrt(((A / V) / l))
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = t_1
	elif (V * l) <= -5e-204:
		tmp = t_0
	elif (V * l) <= 1e-271:
		tmp = t_1
	elif (V * l) <= 5e+147:
		tmp = t_0
	else:
		tmp = t_1
	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 * sqrt(Float64(A / Float64(V * l))))
	t_1 = Float64(c0 * sqrt(Float64(Float64(A / V) / l)))
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = t_1;
	elseif (Float64(V * l) <= -5e-204)
		tmp = t_0;
	elseif (Float64(V * l) <= 1e-271)
		tmp = t_1;
	elseif (Float64(V * l) <= 5e+147)
		tmp = t_0;
	else
		tmp = t_1;
	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 = c0 * sqrt((A / (V * l)));
	t_1 = c0 * sqrt(((A / V) / l));
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = t_1;
	elseif ((V * l) <= -5e-204)
		tmp = t_0;
	elseif ((V * l) <= 1e-271)
		tmp = t_1;
	elseif ((V * l) <= 5e+147)
		tmp = t_0;
	else
		tmp = t_1;
	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[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], t$95$1, If[LessEqual[N[(V * l), $MachinePrecision], -5e-204], t$95$0, If[LessEqual[N[(V * l), $MachinePrecision], 1e-271], t$95$1, If[LessEqual[N[(V * l), $MachinePrecision], 5e+147], t$95$0, t$95$1]]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
t_1 := c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;t_1\\

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

\mathbf{elif}\;V \cdot \ell \leq 10^{-271}:\\
\;\;\;\;t_1\\

\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+147}:\\
\;\;\;\;t_0\\

\mathbf{else}:\\
\;\;\;\;t_1\\


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 2 regimes
  2. if (*.f64 V l) < -inf.0 or -5.0000000000000002e-204 < (*.f64 V l) < 9.99999999999999963e-272 or 5.0000000000000002e147 < (*.f64 V l)

    1. Initial program 37.0

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
    2. Simplified25.5

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

      [Start]37.0

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

      rational.json-simplify-46 [=>]25.5

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

      rational.json-simplify-44 [=>]25.5

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

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

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

    if -inf.0 < (*.f64 V l) < -5.0000000000000002e-204 or 9.99999999999999963e-272 < (*.f64 V l) < 5.0000000000000002e147

    1. Initial program 8.3

      \[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
  3. Recombined 2 regimes into one program.
  4. Final simplification14.8

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

Alternatives

Alternative 1
Error15.2
Cost7624
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 2 \cdot 10^{-301}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 2 \cdot 10^{+256}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \end{array} \]
Alternative 2
Error19.1
Cost6848
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

Error

Reproduce?

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