?

Average Error: 18.8 → 5.5
Time: 12.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}\\ t_1 := \sqrt{-A}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;\frac{t_1}{\frac{\sqrt{\ell}}{c0} \cdot t_0}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-188}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{t_1}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\frac{t_0}{\sqrt{\frac{-A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+256}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \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))) (t_1 (sqrt (- A))))
   (if (<= (* V l) (- INFINITY))
     (/ t_1 (* (/ (sqrt l) c0) t_0))
     (if (<= (* V l) -1e-188)
       (/ c0 (/ (sqrt (* V (- l))) t_1))
       (if (<= (* V l) 0.0)
         (/ c0 (/ t_0 (sqrt (/ (- A) l))))
         (if (<= (* V l) 2e+256)
           (* c0 (/ (sqrt A) (sqrt (* V l))))
           (* c0 (sqrt (/ (/ A V) 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 t_1 = sqrt(-A);
	double tmp;
	if ((V * l) <= -((double) INFINITY)) {
		tmp = t_1 / ((sqrt(l) / c0) * t_0);
	} else if ((V * l) <= -1e-188) {
		tmp = c0 / (sqrt((V * -l)) / t_1);
	} else if ((V * l) <= 0.0) {
		tmp = c0 / (t_0 / sqrt((-A / l)));
	} else if ((V * l) <= 2e+256) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 * sqrt(((A / V) / l));
	}
	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(-V);
	double t_1 = Math.sqrt(-A);
	double tmp;
	if ((V * l) <= -Double.POSITIVE_INFINITY) {
		tmp = t_1 / ((Math.sqrt(l) / c0) * t_0);
	} else if ((V * l) <= -1e-188) {
		tmp = c0 / (Math.sqrt((V * -l)) / t_1);
	} else if ((V * l) <= 0.0) {
		tmp = c0 / (t_0 / Math.sqrt((-A / l)));
	} else if ((V * l) <= 2e+256) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 * Math.sqrt(((A / V) / 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)
	t_1 = math.sqrt(-A)
	tmp = 0
	if (V * l) <= -math.inf:
		tmp = t_1 / ((math.sqrt(l) / c0) * t_0)
	elif (V * l) <= -1e-188:
		tmp = c0 / (math.sqrt((V * -l)) / t_1)
	elif (V * l) <= 0.0:
		tmp = c0 / (t_0 / math.sqrt((-A / l)))
	elif (V * l) <= 2e+256:
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 * math.sqrt(((A / V) / 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))
	t_1 = sqrt(Float64(-A))
	tmp = 0.0
	if (Float64(V * l) <= Float64(-Inf))
		tmp = Float64(t_1 / Float64(Float64(sqrt(l) / c0) * t_0));
	elseif (Float64(V * l) <= -1e-188)
		tmp = Float64(c0 / Float64(sqrt(Float64(V * Float64(-l))) / t_1));
	elseif (Float64(V * l) <= 0.0)
		tmp = Float64(c0 / Float64(t_0 / sqrt(Float64(Float64(-A) / l))));
	elseif (Float64(V * l) <= 2e+256)
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / 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);
	t_1 = sqrt(-A);
	tmp = 0.0;
	if ((V * l) <= -Inf)
		tmp = t_1 / ((sqrt(l) / c0) * t_0);
	elseif ((V * l) <= -1e-188)
		tmp = c0 / (sqrt((V * -l)) / t_1);
	elseif ((V * l) <= 0.0)
		tmp = c0 / (t_0 / sqrt((-A / l)));
	elseif ((V * l) <= 2e+256)
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 * sqrt(((A / V) / 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]}, Block[{t$95$1 = N[Sqrt[(-A)], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(t$95$1 / N[(N[(N[Sqrt[l], $MachinePrecision] / c0), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-188], N[(c0 / N[(N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision] / t$95$1), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 / N[(t$95$0 / N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 2e+256], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := \sqrt{-V}\\
t_1 := \sqrt{-A}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;\frac{t_1}{\frac{\sqrt{\ell}}{c0} \cdot t_0}\\

\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-188}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{t_1}}\\

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

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

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


\end{array}

Error?

Try it out?

Your Program's Arguments

Results

Enter valid numbers for all inputs

Derivation?

  1. Split input into 5 regimes
  2. if (*.f64 V l) < -inf.0

    1. Initial program 41.9

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

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

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

      [Start]11.4

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

      *-commutative [=>]11.4

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

      associate-/l* [=>]11.2

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

      associate-/r/ [=>]10.7

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

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

    if -inf.0 < (*.f64 V l) < -9.9999999999999995e-189

    1. Initial program 8.5

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

      \[\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]2.4

      \[ \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 -9.9999999999999995e-189 < (*.f64 V l) < 0.0

    1. Initial program 45.4

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

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

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

    if 0.0 < (*.f64 V l) < 2.0000000000000001e256

    1. Initial program 10.5

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

      \[\leadsto c0 \cdot \color{blue}{{\left({\left(\frac{A}{V \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333}} \]
    3. Simplified21.6

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

      [Start]24.1

      \[ c0 \cdot {\left({\left(\frac{A}{V \cdot \ell}\right)}^{1.5}\right)}^{0.3333333333333333} \]

      unpow1/3 [=>]21.6

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

      \[\leadsto \color{blue}{\frac{c0 \cdot \sqrt{A}}{\sqrt{V \cdot \ell}}} \]
    5. Simplified0.8

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

      [Start]2.9

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

      *-commutative [=>]2.9

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

      associate-/l* [=>]2.9

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

      associate-/r/ [=>]0.8

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

    if 2.0000000000000001e256 < (*.f64 V l)

    1. Initial program 32.3

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

      \[\leadsto \color{blue}{\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}} \]
    3. Simplified20.8

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

      [Start]20.8

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

      associate-/r/ [=>]20.8

      \[ \frac{c0}{\sqrt{\color{blue}{\frac{V}{A} \cdot \ell}}} \]
    4. Taylor expanded in c0 around 0 32.3

      \[\leadsto \color{blue}{\sqrt{\frac{A}{V \cdot \ell}} \cdot c0} \]
    5. Simplified20.1

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

      [Start]32.3

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

      associate-/r* [=>]20.1

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

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

Alternatives

Alternative 1
Error14.7
Cost34640
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{if}\;t_0 \leq -\infty:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \mathbf{elif}\;t_0 \leq -1 \cdot 10^{-268}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_0 \leq 10^{-156}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+295}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;\sqrt{c0 \cdot \left(\frac{c0}{V} \cdot \frac{A}{\ell}\right)}\\ \end{array} \]
Alternative 2
Error15.0
Cost34512
\[\begin{array}{l} t_0 := \frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ t_1 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{if}\;t_1 \leq -\infty:\\ \;\;\;\;t_0\\ \mathbf{elif}\;t_1 \leq -1 \cdot 10^{-268}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;t_1 \leq 10^{-156}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_1 \leq 5 \cdot 10^{+256}:\\ \;\;\;\;t_1\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 3
Error12.7
Cost14288
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+280}:\\ \;\;\;\;\sqrt{\frac{A}{V} \cdot \frac{c0 \cdot c0}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-130}:\\ \;\;\;\;\frac{c0}{\sqrt{\left(V \cdot \ell\right) \cdot \frac{1}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{-278}:\\ \;\;\;\;c0 \cdot {\left(\ell \cdot \frac{V}{A}\right)}^{-0.5}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+256}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
Alternative 4
Error8.4
Cost14288
\[\begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+87}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-132}:\\ \;\;\;\;\frac{c0}{\sqrt{\left(V \cdot \ell\right) \cdot \frac{1}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+256}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
Alternative 5
Error8.4
Cost14288
\[\begin{array}{l} t_0 := \sqrt{\frac{A}{V}}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+87}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{t_0}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-132}:\\ \;\;\;\;\frac{c0}{\sqrt{\left(V \cdot \ell\right) \cdot \frac{1}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \frac{t_0}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+256}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
Alternative 6
Error8.3
Cost14288
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+87}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{\ell}}{\sqrt{\frac{A}{V}}}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-130}:\\ \;\;\;\;\frac{c0}{\sqrt{\left(V \cdot \ell\right) \cdot \frac{1}{A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{-V}}{\sqrt{\frac{-A}{\ell}}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+256}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
Alternative 7
Error6.0
Cost14288
\[\begin{array}{l} t_0 := \frac{c0}{\frac{\sqrt{-V}}{\sqrt{\frac{-A}{\ell}}}}\\ \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-188}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{\sqrt{-A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{+256}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
Alternative 8
Error15.0
Cost7625
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 4 \cdot 10^{+280}\right):\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \end{array} \]
Alternative 9
Error18.8
Cost6848
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
Alternative 10
Error55.0
Cost64
\[0 \]

Error

Reproduce?

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