Average Error: 19.6 → 16.9
Time: 23.0s
Precision: binary64
Cost: 14284
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]
\[\begin{array}{l} t_0 := \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+292}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq 10^{+273}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;t_0 \ne 0:\\ \;\;\;\;\frac{c0}{\frac{1}{t_0}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot t_0\\ \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 V) l))))
   (if (<= (* V l) -1e+292)
     (* c0 (sqrt (/ (/ A l) V)))
     (if (<= (* V l) 1e+273)
       (* c0 (sqrt (/ A (* V l))))
       (if (!= t_0 0.0) (/ c0 (/ 1.0 t_0)) (* c0 t_0))))))
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 / V) / l));
	double tmp;
	if ((V * l) <= -1e+292) {
		tmp = c0 * sqrt(((A / l) / V));
	} else if ((V * l) <= 1e+273) {
		tmp = c0 * sqrt((A / (V * l)));
	} else if (t_0 != 0.0) {
		tmp = c0 / (1.0 / t_0);
	} else {
		tmp = c0 * t_0;
	}
	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(((a / v) / l))
    if ((v * l) <= (-1d+292)) then
        tmp = c0 * sqrt(((a / l) / v))
    else if ((v * l) <= 1d+273) then
        tmp = c0 * sqrt((a / (v * l)))
    else if (t_0 /= 0.0d0) then
        tmp = c0 / (1.0d0 / t_0)
    else
        tmp = c0 * t_0
    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 / V) / l));
	double tmp;
	if ((V * l) <= -1e+292) {
		tmp = c0 * Math.sqrt(((A / l) / V));
	} else if ((V * l) <= 1e+273) {
		tmp = c0 * Math.sqrt((A / (V * l)));
	} else if (t_0 != 0.0) {
		tmp = c0 / (1.0 / t_0);
	} else {
		tmp = c0 * t_0;
	}
	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 / V) / l))
	tmp = 0
	if (V * l) <= -1e+292:
		tmp = c0 * math.sqrt(((A / l) / V))
	elif (V * l) <= 1e+273:
		tmp = c0 * math.sqrt((A / (V * l)))
	elif t_0 != 0.0:
		tmp = c0 / (1.0 / t_0)
	else:
		tmp = c0 * t_0
	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 / V) / l))
	tmp = 0.0
	if (Float64(V * l) <= -1e+292)
		tmp = Float64(c0 * sqrt(Float64(Float64(A / l) / V)));
	elseif (Float64(V * l) <= 1e+273)
		tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l))));
	elseif (t_0 != 0.0)
		tmp = Float64(c0 / Float64(1.0 / t_0));
	else
		tmp = Float64(c0 * t_0);
	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(((A / V) / l));
	tmp = 0.0;
	if ((V * l) <= -1e+292)
		tmp = c0 * sqrt(((A / l) / V));
	elseif ((V * l) <= 1e+273)
		tmp = c0 * sqrt((A / (V * l)));
	elseif (t_0 ~= 0.0)
		tmp = c0 / (1.0 / t_0);
	else
		tmp = c0 * t_0;
	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[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -1e+292], N[(c0 * N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+273], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Unequal[t$95$0, 0.0], N[(c0 / N[(1.0 / t$95$0), $MachinePrecision]), $MachinePrecision], N[(c0 * t$95$0), $MachinePrecision]]]]]
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\begin{array}{l}
t_0 := \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+292}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\

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

\mathbf{elif}\;t_0 \ne 0:\\
\;\;\;\;\frac{c0}{\frac{1}{t_0}}\\

\mathbf{else}:\\
\;\;\;\;c0 \cdot t_0\\


\end{array}

Error

Derivation

  1. Split input into 3 regimes
  2. if (*.f64 V l) < -1e292

    1. Initial program 38.4

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

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

    if -1e292 < (*.f64 V l) < 9.99999999999999945e272

    1. Initial program 15.9

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

    if 9.99999999999999945e272 < (*.f64 V l)

    1. Initial program 38.4

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

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

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

Alternatives

Alternative 1
Error16.9
Cost7628
\[\begin{array}{l} t_0 := \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+292}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.5 \cdot 10^{+248}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{elif}\;c0 \ne 0:\\ \;\;\;\;\frac{t_0}{\frac{1}{c0}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot t_0\\ \end{array} \]
Alternative 2
Error16.9
Cost7368
\[\begin{array}{l} \mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+292}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{\ell}}{V}}\\ \mathbf{elif}\;V \cdot \ell \leq 1.5 \cdot 10^{+248}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\ \mathbf{else}:\\ \;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\ \end{array} \]
Alternative 3
Error16.9
Cost7236
\[\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{else}:\\ \;\;\;\;c0 \cdot \sqrt{t_0}\\ \end{array} \]
Alternative 4
Error19.6
Cost6848
\[c0 \cdot \sqrt{\frac{A}{V \cdot \ell}} \]

Error

Reproduce

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