?

Average Error: 19.7 → 15.2
Time: 2.3min
Precision: binary64
Cost: 27468

?

\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} t_0 := \sqrt{\frac{\frac{A}{\ell}}{V}}\\ t_1 := c0 \cdot t_0\\ t_2 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_2 \leq 5 \cdot 10^{-312}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{3 \cdot \frac{A}{V}}{3 \cdot \ell}}\\ \mathbf{elif}\;t_2 \leq 10^{+282}:\\ \;\;\;\;c0 \cdot \sqrt{\begin{array}{l} \mathbf{if}\;A \ne 0:\\ \;\;\;\;\frac{1}{\frac{V \cdot \ell}{A}}\\ \mathbf{else}:\\ \;\;\;\;t_2\\ \end{array}}\\ \mathbf{elif}\;t_1 \ne 0:\\ \;\;\;\;{\left(\frac{{c0}^{-1}}{t_0}\right)}^{-1}\\ \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 (sqrt (/ (/ A l) V))) (t_1 (* c0 t_0)) (t_2 (/ A (* V l))))
   (if (<= t_2 5e-312)
     (* c0 (sqrt (/ (* 3.0 (/ A V)) (* 3.0 l))))
     (if (<= t_2 1e+282)
       (* c0 (sqrt (if (!= A 0.0) (/ 1.0 (/ (* V l) A)) t_2)))
       (if (!= t_1 0.0) (pow (/ (pow c0 -1.0) t_0) -1.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 = sqrt(((A / l) / V));
	double t_1 = c0 * t_0;
	double t_2 = A / (V * l);
	double tmp;
	if (t_2 <= 5e-312) {
		tmp = c0 * sqrt(((3.0 * (A / V)) / (3.0 * l)));
	} else if (t_2 <= 1e+282) {
		double tmp_1;
		if (A != 0.0) {
			tmp_1 = 1.0 / ((V * l) / A);
		} else {
			tmp_1 = t_2;
		}
		tmp = c0 * sqrt(tmp_1);
	} else if (t_1 != 0.0) {
		tmp = pow((pow(c0, -1.0) / t_0), -1.0);
	} else {
		tmp = t_1;
	}
	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) :: t_1
    real(8) :: t_2
    real(8) :: tmp
    real(8) :: tmp_1
    t_0 = sqrt(((a / l) / v))
    t_1 = c0 * t_0
    t_2 = a / (v * l)
    if (t_2 <= 5d-312) then
        tmp = c0 * sqrt(((3.0d0 * (a / v)) / (3.0d0 * l)))
    else if (t_2 <= 1d+282) then
        if (a /= 0.0d0) then
            tmp_1 = 1.0d0 / ((v * l) / a)
        else
            tmp_1 = t_2
        end if
        tmp = c0 * sqrt(tmp_1)
    else if (t_1 /= 0.0d0) then
        tmp = ((c0 ** (-1.0d0)) / t_0) ** (-1.0d0)
    else
        tmp = t_1
    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(((A / l) / V));
	double t_1 = c0 * t_0;
	double t_2 = A / (V * l);
	double tmp;
	if (t_2 <= 5e-312) {
		tmp = c0 * Math.sqrt(((3.0 * (A / V)) / (3.0 * l)));
	} else if (t_2 <= 1e+282) {
		double tmp_1;
		if (A != 0.0) {
			tmp_1 = 1.0 / ((V * l) / A);
		} else {
			tmp_1 = t_2;
		}
		tmp = c0 * Math.sqrt(tmp_1);
	} else if (t_1 != 0.0) {
		tmp = Math.pow((Math.pow(c0, -1.0) / t_0), -1.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 = math.sqrt(((A / l) / V))
	t_1 = c0 * t_0
	t_2 = A / (V * l)
	tmp = 0
	if t_2 <= 5e-312:
		tmp = c0 * math.sqrt(((3.0 * (A / V)) / (3.0 * l)))
	elif t_2 <= 1e+282:
		tmp_1 = 0
		if A != 0.0:
			tmp_1 = 1.0 / ((V * l) / A)
		else:
			tmp_1 = t_2
		tmp = c0 * math.sqrt(tmp_1)
	elif t_1 != 0.0:
		tmp = math.pow((math.pow(c0, -1.0) / t_0), -1.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 = sqrt(Float64(Float64(A / l) / V))
	t_1 = Float64(c0 * t_0)
	t_2 = Float64(A / Float64(V * l))
	tmp = 0.0
	if (t_2 <= 5e-312)
		tmp = Float64(c0 * sqrt(Float64(Float64(3.0 * Float64(A / V)) / Float64(3.0 * l))));
	elseif (t_2 <= 1e+282)
		tmp_1 = 0.0
		if (A != 0.0)
			tmp_1 = Float64(1.0 / Float64(Float64(V * l) / A));
		else
			tmp_1 = t_2;
		end
		tmp = Float64(c0 * sqrt(tmp_1));
	elseif (t_1 != 0.0)
		tmp = Float64((c0 ^ -1.0) / t_0) ^ -1.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_3 = code(c0, A, V, l)
	t_0 = sqrt(((A / l) / V));
	t_1 = c0 * t_0;
	t_2 = A / (V * l);
	tmp = 0.0;
	if (t_2 <= 5e-312)
		tmp = c0 * sqrt(((3.0 * (A / V)) / (3.0 * l)));
	elseif (t_2 <= 1e+282)
		tmp_2 = 0.0;
		if (A ~= 0.0)
			tmp_2 = 1.0 / ((V * l) / A);
		else
			tmp_2 = t_2;
		end
		tmp = c0 * sqrt(tmp_2);
	elseif (t_1 ~= 0.0)
		tmp = ((c0 ^ -1.0) / t_0) ^ -1.0;
	else
		tmp = t_1;
	end
	tmp_3 = 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[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(c0 * t$95$0), $MachinePrecision]}, Block[{t$95$2 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$2, 5e-312], N[(c0 * N[Sqrt[N[(N[(3.0 * N[(A / V), $MachinePrecision]), $MachinePrecision] / N[(3.0 * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$2, 1e+282], N[(c0 * N[Sqrt[If[Unequal[A, 0.0], N[(1.0 / N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision]), $MachinePrecision], t$95$2]], $MachinePrecision]), $MachinePrecision], If[Unequal[t$95$1, 0.0], N[Power[N[(N[Power[c0, -1.0], $MachinePrecision] / t$95$0), $MachinePrecision], -1.0], $MachinePrecision], t$95$1]]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{A}{\ell}}{V}}\\
t_1 := c0 \cdot t_0\\
t_2 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_2 \leq 5 \cdot 10^{-312}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{3 \cdot \frac{A}{V}}{3 \cdot \ell}}\\

\mathbf{elif}\;t_2 \leq 10^{+282}:\\
\;\;\;\;c0 \cdot \sqrt{\begin{array}{l}
\mathbf{if}\;A \ne 0:\\
\;\;\;\;\frac{1}{\frac{V \cdot \ell}{A}}\\

\mathbf{else}:\\
\;\;\;\;t_2\\


\end{array}}\\

\mathbf{elif}\;t_1 \ne 0:\\
\;\;\;\;{\left(\frac{{c0}^{-1}}{t_0}\right)}^{-1}\\

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


\end{array}

Error?

Derivation?

  1. Split input into 3 regimes
  2. if (/.f64 A (*.f64 V l)) < 5.0000000000022e-312

    1. Initial program 41.2

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{-1}{V \cdot \ell} \cdot \left(-A\right)}} \]
    3. Applied egg-rr29.8

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\frac{0 \cdot \ell + 3 \cdot \frac{A}{V}}{3 \cdot \ell}}} \]
    4. Simplified29.8

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

    if 5.0000000000022e-312 < (/.f64 A (*.f64 V l)) < 1.00000000000000003e282

    1. Initial program 0.5

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

      \[\leadsto c0 \cdot \sqrt{\color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;A \ne 0:\\ \;\;\;\;\frac{1}{\frac{V \cdot \ell}{A}}\\ \mathbf{else}:\\ \;\;\;\;\frac{A}{V \cdot \ell}\\ } \end{array}}} \]

    if 1.00000000000000003e282 < (/.f64 A (*.f64 V l))

    1. Initial program 59.1

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

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \ne 0:\\ \;\;\;\;{\left(\frac{1}{c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ } \end{array}} \]
    3. Simplified47.4

      \[\leadsto \color{blue}{\begin{array}{l} \color{blue}{\mathbf{if}\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}} \ne 0:\\ \;\;\;\;{\left(\frac{{c0}^{-1}}{\sqrt{\frac{\frac{A}{\ell}}{V}}}\right)}^{-1}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ } \end{array}} \]
      Proof
  3. Recombined 3 regimes into one program.

Alternatives

Alternative 1
Error15.2
Cost20940
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-312}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{3 \cdot \frac{A}{V}}{3 \cdot \ell}}\\ \mathbf{elif}\;t_0 \leq 10^{+282}:\\ \;\;\;\;c0 \cdot \sqrt{\begin{array}{l} \mathbf{if}\;A \ne 0:\\ \;\;\;\;\frac{1}{\frac{V \cdot \ell}{A}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\begin{array}{l} \mathbf{if}\;\frac{A}{V} \ne 0:\\ \;\;\;\;\frac{1}{\frac{\ell}{A} \cdot {\left({V}^{-1}\right)}^{-1}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}}\\ \end{array} \]
Alternative 2
Error15.2
Cost8208
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-312}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{3 \cdot \frac{A}{V}}{3 \cdot \ell}}\\ \mathbf{elif}\;t_0 \leq 10^{+282}:\\ \;\;\;\;c0 \cdot \sqrt{\begin{array}{l} \mathbf{if}\;A \ne 0:\\ \;\;\;\;\frac{1}{\frac{V \cdot \ell}{A}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\begin{array}{l} \mathbf{if}\;\frac{A}{V} \ne 0:\\ \;\;\;\;\frac{1}{\begin{array}{l} \mathbf{if}\;-V \ne 0:\\ \;\;\;\;\frac{\ell}{A} \cdot V\\ \mathbf{else}:\\ \;\;\;\;\frac{\ell}{\frac{A}{V}}\\ \end{array}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}}\\ \end{array} \]
Alternative 3
Error14.8
Cost8144
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{3 \cdot \frac{A}{V}}{3 \cdot \ell}}\\ \mathbf{if}\;V \cdot \ell \leq -4 \cdot 10^{+302}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-179}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{-1}{V \cdot \ell} \cdot \left(-A\right)}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+238}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 4
Error14.7
Cost8080
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -4 \cdot 10^{+302}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-210}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{-1}{V \cdot \ell} \cdot \left(-A\right)}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+304}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{-V} \cdot \frac{-1}{\ell}}\\ \end{array} \]
Alternative 5
Error14.8
Cost7888
\[\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 -4 \cdot 10^{+302}:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-179}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+304}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 6
Error14.7
Cost7888
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ t_1 := c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{if}\;V \cdot \ell \leq -4 \cdot 10^{+302}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-210}:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_1\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+238}:\\ \;\;\;\;t_0\\ \mathbf{else}:\\ \;\;\;\;t_1\\ \end{array} \]
Alternative 7
Error14.7
Cost7888
\[\begin{array}{l} t_0 := c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{if}\;V \cdot \ell \leq -4 \cdot 10^{+302}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-210}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{-1}{V \cdot \ell} \cdot \left(-A\right)}\\ \mathbf{elif}\;V \cdot \ell \leq 0:\\ \;\;\;\;t_0\\ \mathbf{elif}\;V \cdot \ell \leq 4 \cdot 10^{+238}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array} \]
Alternative 8
Error15.2
Cost7884
\[\begin{array}{l} t_0 := \frac{A}{V \cdot \ell}\\ \mathbf{if}\;t_0 \leq 5 \cdot 10^{-312}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{3 \cdot \frac{A}{V}}{3 \cdot \ell}}\\ \mathbf{elif}\;t_0 \leq 10^{+282}:\\ \;\;\;\;c0 \cdot \sqrt{\begin{array}{l} \mathbf{if}\;A \ne 0:\\ \;\;\;\;\frac{1}{\frac{V \cdot \ell}{A}}\\ \mathbf{else}:\\ \;\;\;\;t_0\\ \end{array}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \end{array} \]
Alternative 9
Error19.7
Cost6848
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

Error

Reproduce?

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