?

Average Error: 18.6 → 6.9
Time: 12.8s
Precision: binary64
Cost: 19908

?

\[ \begin{array}{c}[V, l] = \mathsf{sort}([V, l])\\ \end{array} \]
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} \mathbf{if}\;A \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{-V} \cdot \sqrt{\ell}}{\sqrt{-A}}}\\ \mathbf{elif}\;A \leq 1.8 \cdot 10^{-172} \lor \neg \left(A \leq 1.45 \cdot 10^{-74}\right):\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V} \cdot \frac{1}{\ell}}\\ \end{array} \]
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
(FPCore (c0 A V l)
 :precision binary64
 (if (<= A -2e-310)
   (/ c0 (/ (* (sqrt (- V)) (sqrt l)) (sqrt (- A))))
   (if (or (<= A 1.8e-172) (not (<= A 1.45e-74)))
     (* c0 (/ (sqrt A) (sqrt (* V l))))
     (* c0 (sqrt (* (/ A V) (/ 1.0 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 tmp;
	if (A <= -2e-310) {
		tmp = c0 / ((sqrt(-V) * sqrt(l)) / sqrt(-A));
	} else if ((A <= 1.8e-172) || !(A <= 1.45e-74)) {
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	} else {
		tmp = c0 * sqrt(((A / V) * (1.0 / 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) :: tmp
    if (a <= (-2d-310)) then
        tmp = c0 / ((sqrt(-v) * sqrt(l)) / sqrt(-a))
    else if ((a <= 1.8d-172) .or. (.not. (a <= 1.45d-74))) then
        tmp = c0 * (sqrt(a) / sqrt((v * l)))
    else
        tmp = c0 * sqrt(((a / v) * (1.0d0 / 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 tmp;
	if (A <= -2e-310) {
		tmp = c0 / ((Math.sqrt(-V) * Math.sqrt(l)) / Math.sqrt(-A));
	} else if ((A <= 1.8e-172) || !(A <= 1.45e-74)) {
		tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
	} else {
		tmp = c0 * Math.sqrt(((A / V) * (1.0 / l)));
	}
	return tmp;
}
def code(c0, A, V, l):
	return c0 * math.sqrt((A / (V * l)))
def code(c0, A, V, l):
	tmp = 0
	if A <= -2e-310:
		tmp = c0 / ((math.sqrt(-V) * math.sqrt(l)) / math.sqrt(-A))
	elif (A <= 1.8e-172) or not (A <= 1.45e-74):
		tmp = c0 * (math.sqrt(A) / math.sqrt((V * l)))
	else:
		tmp = c0 * math.sqrt(((A / V) * (1.0 / 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)
	tmp = 0.0
	if (A <= -2e-310)
		tmp = Float64(c0 / Float64(Float64(sqrt(Float64(-V)) * sqrt(l)) / sqrt(Float64(-A))));
	elseif ((A <= 1.8e-172) || !(A <= 1.45e-74))
		tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l))));
	else
		tmp = Float64(c0 * sqrt(Float64(Float64(A / V) * Float64(1.0 / 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)
	tmp = 0.0;
	if (A <= -2e-310)
		tmp = c0 / ((sqrt(-V) * sqrt(l)) / sqrt(-A));
	elseif ((A <= 1.8e-172) || ~((A <= 1.45e-74)))
		tmp = c0 * (sqrt(A) / sqrt((V * l)));
	else
		tmp = c0 * sqrt(((A / V) * (1.0 / 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_] := If[LessEqual[A, -2e-310], N[(c0 / N[(N[(N[Sqrt[(-V)], $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision] / N[Sqrt[(-A)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[A, 1.8e-172], N[Not[LessEqual[A, 1.45e-74]], $MachinePrecision]], 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] * N[(1.0 / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
\mathbf{if}\;A \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{-V} \cdot \sqrt{\ell}}{\sqrt{-A}}}\\

\mathbf{elif}\;A \leq 1.8 \cdot 10^{-172} \lor \neg \left(A \leq 1.45 \cdot 10^{-74}\right):\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\

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


\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 A < -1.999999999999994e-310

    1. Initial program 18.8

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

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

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

      [Start]18.7

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

      associate-/r/ [=>]18.5

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

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

    if -1.999999999999994e-310 < A < 1.80000000000000007e-172 or 1.45e-74 < A

    1. Initial program 19.0

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

      \[\leadsto c0 \cdot \color{blue}{\left(\sqrt{A} \cdot \frac{1}{\sqrt{V \cdot \ell}}\right)} \]
    3. Simplified11.6

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

      [Start]11.6

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

      *-commutative [<=]11.6

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

      associate-*l/ [=>]11.6

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

      *-lft-identity [=>]11.6

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

    if 1.80000000000000007e-172 < A < 1.45e-74

    1. Initial program 15.6

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;A \leq -2 \cdot 10^{-310}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{-V} \cdot \sqrt{\ell}}{\sqrt{-A}}}\\ \mathbf{elif}\;A \leq 1.8 \cdot 10^{-172} \lor \neg \left(A \leq 1.45 \cdot 10^{-74}\right):\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V} \cdot \frac{1}{\ell}}\\ \end{array} \]

Alternatives

Alternative 1
Error9.2
Cost14028
\[\begin{array}{l} t_0 := c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+200}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq -7.8 \cdot 10^{-233}:\\ \;\;\;\;\frac{c0}{{\left(\frac{A}{V \cdot \ell}\right)}^{-0.5}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-312}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]
Alternative 2
Error7.8
Cost14028
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-298}:\\ \;\;\;\;\sqrt{-A} \cdot \frac{c0}{\sqrt{V \cdot \left(-\ell\right)}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-312}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]
Alternative 3
Error7.1
Cost14028
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -5 \cdot 10^{+248}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-298}:\\ \;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \left(-\ell\right)}}{\sqrt{-A}}}\\ \mathbf{elif}\;V \cdot \ell \leq 2 \cdot 10^{-312}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]
Alternative 4
Error13.9
Cost13508
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq 2 \cdot 10^{-312}:\\ \;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\ \end{array} \]
Alternative 5
Error14.0
Cost7890
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -\infty \lor \neg \left(V \cdot \ell \leq -1 \cdot 10^{-165} \lor \neg \left(V \cdot \ell \leq 2 \cdot 10^{-172}\right) \land V \cdot \ell \leq 10^{+248}\right):\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \end{array} \]
Alternative 6
Error14.0
Cost7688
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 10^{+284}:\\ \;\;\;\;\frac{c0}{{t_0}^{-0.5}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \end{array} \]
Alternative 7
Error14.4
Cost7688
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;\sqrt{A \cdot \left(\frac{c0}{V} \cdot \frac{c0}{\ell}\right)}\\ \mathbf{elif}\;t_0 \leq 10^{+284}:\\ \;\;\;\;\frac{c0}{{t_0}^{-0.5}}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \end{array} \]
Alternative 8
Error13.7
Cost7624
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 10^{+304}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\ \end{array} \]
Alternative 9
Error14.0
Cost7624
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;t_0 \leq 5 \cdot 10^{+286}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \mathbf{else}:\\ \;\;\;\;\frac{c0}{\sqrt{\frac{V}{\frac{A}{\ell}}}}\\ \end{array} \]
Alternative 10
Error18.6
Cost6848
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

Error

Reproduce?

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