
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
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
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
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
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
function tmp = code(c0, A, V, l) tmp = c0 * sqrt((A / (V * l))); end
code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) (- INFINITY))
(* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V))))
(if (<= (* V l) -1e-300)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 1e+228)
(* c0 (* (sqrt A) (pow (* V l) -0.5)))
(/ (sqrt A) (* (sqrt V) (/ (sqrt l) c0))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
} else if ((V * l) <= -1e-300) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 1e+228) {
tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
} else {
tmp = sqrt(A) / (sqrt(V) * (sqrt(l) / c0));
}
return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
} else if ((V * l) <= -1e-300) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 1e+228) {
tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
} else {
tmp = Math.sqrt(A) / (Math.sqrt(V) * (Math.sqrt(l) / c0));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = c0 * (math.sqrt((-A / l)) / math.sqrt(-V)) elif (V * l) <= -1e-300: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 1e+228: tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5)) else: tmp = math.sqrt(A) / (math.sqrt(V) * (math.sqrt(l) / c0)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V)))); elseif (Float64(V * l) <= -1e-300) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 1e+228) tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5))); else tmp = Float64(sqrt(A) / Float64(sqrt(V) * Float64(sqrt(l) / c0))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
elseif ((V * l) <= -1e-300)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 1e+228)
tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
else
tmp = sqrt(A) / (sqrt(V) * (sqrt(l) / c0));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-300], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+228], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[A], $MachinePrecision] / N[(N[Sqrt[V], $MachinePrecision] * N[(N[Sqrt[l], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-300}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+228}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{\sqrt{A}}{\sqrt{V} \cdot \frac{\sqrt{\ell}}{c0}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 58.4%
associate-/r*70.4%
div-inv70.4%
Applied egg-rr70.4%
un-div-inv70.4%
Applied egg-rr70.4%
associate-/l/58.4%
*-commutative58.4%
associate-/l/70.3%
frac-2neg70.3%
sqrt-div50.3%
distribute-neg-frac50.3%
Applied egg-rr50.3%
if -inf.0 < (*.f64 V l) < -1.00000000000000003e-300Initial program 83.8%
frac-2neg83.8%
sqrt-div99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
if -1.00000000000000003e-300 < (*.f64 V l) < 0.0Initial program 41.4%
associate-/r*67.3%
sqrt-div55.2%
Applied egg-rr55.2%
if 0.0 < (*.f64 V l) < 9.9999999999999992e227Initial program 89.4%
div-inv89.0%
sqrt-prod98.5%
pow1/298.5%
inv-pow98.5%
pow-pow98.8%
metadata-eval98.8%
Applied egg-rr98.8%
if 9.9999999999999992e227 < (*.f64 V l) Initial program 40.1%
associate-/r*45.4%
div-inv45.3%
Applied egg-rr45.3%
frac-times40.1%
div-inv40.1%
*-rgt-identity40.1%
inv-pow40.1%
metadata-eval40.1%
pow-prod-up40.1%
sqrt-prod48.1%
sqrt-unprod48.2%
add-sqr-sqrt48.1%
associate-*r*48.1%
metadata-eval48.1%
pow-flip48.1%
pow1/248.1%
div-inv48.2%
associate-*l/48.2%
*-commutative48.2%
clear-num48.2%
un-div-inv48.3%
Applied egg-rr48.3%
div-inv48.2%
sqrt-prod78.7%
associate-*l*78.9%
Applied egg-rr78.9%
associate-*r/78.7%
*-rgt-identity78.7%
Simplified78.7%
Final simplification89.2%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) (- INFINITY))
(* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V))))
(if (<= (* V l) -1e-300)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 5e+279)
(* c0 (* (sqrt A) (pow (* V l) -0.5)))
(* (sqrt A) (/ (/ c0 (sqrt V)) (sqrt l))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
} else if ((V * l) <= -1e-300) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
} else {
tmp = sqrt(A) * ((c0 / sqrt(V)) / sqrt(l));
}
return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
} else if ((V * l) <= -1e-300) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
} else {
tmp = Math.sqrt(A) * ((c0 / Math.sqrt(V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = c0 * (math.sqrt((-A / l)) / math.sqrt(-V)) elif (V * l) <= -1e-300: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 5e+279: tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5)) else: tmp = math.sqrt(A) * ((c0 / math.sqrt(V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V)))); elseif (Float64(V * l) <= -1e-300) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 5e+279) tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5))); else tmp = Float64(sqrt(A) * Float64(Float64(c0 / sqrt(V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
elseif ((V * l) <= -1e-300)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 5e+279)
tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
else
tmp = sqrt(A) * ((c0 / sqrt(V)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-300], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+279], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Sqrt[A], $MachinePrecision] * N[(N[(c0 / N[Sqrt[V], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-300}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+279}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A} \cdot \frac{\frac{c0}{\sqrt{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 58.4%
associate-/r*70.4%
div-inv70.4%
Applied egg-rr70.4%
un-div-inv70.4%
Applied egg-rr70.4%
associate-/l/58.4%
*-commutative58.4%
associate-/l/70.3%
frac-2neg70.3%
sqrt-div50.3%
distribute-neg-frac50.3%
Applied egg-rr50.3%
if -inf.0 < (*.f64 V l) < -1.00000000000000003e-300Initial program 83.8%
frac-2neg83.8%
sqrt-div99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
if -1.00000000000000003e-300 < (*.f64 V l) < 0.0Initial program 41.4%
associate-/r*67.3%
sqrt-div55.2%
Applied egg-rr55.2%
if 0.0 < (*.f64 V l) < 5.0000000000000002e279Initial program 89.0%
div-inv88.6%
sqrt-prod98.5%
pow1/298.5%
inv-pow98.5%
pow-pow98.9%
metadata-eval98.9%
Applied egg-rr98.9%
if 5.0000000000000002e279 < (*.f64 V l) Initial program 29.6%
sqrt-div34.7%
associate-*r/34.6%
Applied egg-rr34.6%
associate-*l/34.7%
Simplified34.7%
*-un-lft-identity34.7%
sqrt-prod73.3%
times-frac73.2%
Applied egg-rr73.2%
associate-*r/73.1%
associate-*l/73.3%
*-lft-identity73.3%
Simplified73.3%
Final simplification89.2%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) (- INFINITY))
(* c0 (/ (sqrt (/ (- A) l)) (sqrt (- V))))
(if (<= (* V l) -1e-300)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 5e+279)
(* c0 (* (sqrt A) (pow (* V l) -0.5)))
(sqrt (* A (/ (/ c0 V) (/ l c0)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
} else if ((V * l) <= -1e-300) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
} else {
tmp = sqrt((A * ((c0 / V) / (l / c0))));
}
return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = c0 * (Math.sqrt((-A / l)) / Math.sqrt(-V));
} else if ((V * l) <= -1e-300) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
} else {
tmp = Math.sqrt((A * ((c0 / V) / (l / c0))));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -math.inf: tmp = c0 * (math.sqrt((-A / l)) / math.sqrt(-V)) elif (V * l) <= -1e-300: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 5e+279: tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5)) else: tmp = math.sqrt((A * ((c0 / V) / (l / c0)))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0 * Float64(sqrt(Float64(Float64(-A) / l)) / sqrt(Float64(-V)))); elseif (Float64(V * l) <= -1e-300) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 5e+279) tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5))); else tmp = sqrt(Float64(A * Float64(Float64(c0 / V) / Float64(l / c0)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = c0 * (sqrt((-A / l)) / sqrt(-V));
elseif ((V * l) <= -1e-300)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 5e+279)
tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
else
tmp = sqrt((A * ((c0 / V) / (l / c0))));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], (-Infinity)], N[(c0 * N[(N[Sqrt[N[((-A) / l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[(-V)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-300], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+279], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(A * N[(N[(c0 / V), $MachinePrecision] / N[(l / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{-A}{\ell}}}{\sqrt{-V}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-300}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+279}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A \cdot \frac{\frac{c0}{V}}{\frac{\ell}{c0}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 58.4%
associate-/r*70.4%
div-inv70.4%
Applied egg-rr70.4%
un-div-inv70.4%
Applied egg-rr70.4%
associate-/l/58.4%
*-commutative58.4%
associate-/l/70.3%
frac-2neg70.3%
sqrt-div50.3%
distribute-neg-frac50.3%
Applied egg-rr50.3%
if -inf.0 < (*.f64 V l) < -1.00000000000000003e-300Initial program 83.8%
frac-2neg83.8%
sqrt-div99.5%
*-commutative99.5%
distribute-rgt-neg-in99.5%
Applied egg-rr99.5%
if -1.00000000000000003e-300 < (*.f64 V l) < 0.0Initial program 41.4%
associate-/r*67.3%
sqrt-div55.2%
Applied egg-rr55.2%
if 0.0 < (*.f64 V l) < 5.0000000000000002e279Initial program 89.0%
div-inv88.6%
sqrt-prod98.5%
pow1/298.5%
inv-pow98.5%
pow-pow98.9%
metadata-eval98.9%
Applied egg-rr98.9%
if 5.0000000000000002e279 < (*.f64 V l) Initial program 29.6%
associate-/r*36.2%
div-inv36.2%
Applied egg-rr36.2%
un-div-inv36.2%
Applied egg-rr36.2%
add-sqr-sqrt12.1%
sqrt-prod28.1%
pow1/228.1%
pow1/228.1%
associate-/l/28.0%
*-commutative28.0%
associate-/l/28.1%
unpow-prod-down28.1%
clear-num28.2%
associate-/l*28.0%
div-inv28.0%
associate-/r/28.1%
frac-times59.6%
*-commutative59.6%
associate-*l*59.4%
Applied egg-rr59.4%
unpow1/259.4%
associate-*r*59.6%
*-commutative59.6%
*-commutative59.6%
associate-*r/54.5%
associate-/l*59.7%
Simplified59.7%
Final simplification88.2%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) -1e-300)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 5e+279)
(* c0 (* (sqrt A) (pow (* V l) -0.5)))
(sqrt (* A (/ (/ c0 V) (/ l c0))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -1e-300) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
} else {
tmp = sqrt((A * ((c0 / V) / (l / c0))));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this 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 ((v * l) <= (-1d-300)) then
tmp = c0 * (sqrt(-a) / sqrt((v * -l)))
else if ((v * l) <= 0.0d0) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else if ((v * l) <= 5d+279) then
tmp = c0 * (sqrt(a) * ((v * l) ** (-0.5d0)))
else
tmp = sqrt((a * ((c0 / v) / (l / c0))))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -1e-300) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
} else {
tmp = Math.sqrt((A * ((c0 / V) / (l / c0))));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -1e-300: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 5e+279: tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5)) else: tmp = math.sqrt((A * ((c0 / V) / (l / c0)))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -1e-300) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 5e+279) tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5))); else tmp = sqrt(Float64(A * Float64(Float64(c0 / V) / Float64(l / c0)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= -1e-300)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 5e+279)
tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
else
tmp = sqrt((A * ((c0 / V) / (l / c0))));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], -1e-300], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(V * (-l)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+279], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(A * N[(N[(c0 / V), $MachinePrecision] / N[(l / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{-300}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+279}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A \cdot \frac{\frac{c0}{V}}{\frac{\ell}{c0}}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1.00000000000000003e-300Initial program 79.9%
frac-2neg79.9%
sqrt-div93.2%
*-commutative93.2%
distribute-rgt-neg-in93.2%
Applied egg-rr93.2%
if -1.00000000000000003e-300 < (*.f64 V l) < 0.0Initial program 41.4%
associate-/r*67.3%
sqrt-div55.2%
Applied egg-rr55.2%
if 0.0 < (*.f64 V l) < 5.0000000000000002e279Initial program 89.0%
div-inv88.6%
sqrt-prod98.5%
pow1/298.5%
inv-pow98.5%
pow-pow98.9%
metadata-eval98.9%
Applied egg-rr98.9%
if 5.0000000000000002e279 < (*.f64 V l) Initial program 29.6%
associate-/r*36.2%
div-inv36.2%
Applied egg-rr36.2%
un-div-inv36.2%
Applied egg-rr36.2%
add-sqr-sqrt12.1%
sqrt-prod28.1%
pow1/228.1%
pow1/228.1%
associate-/l/28.0%
*-commutative28.0%
associate-/l/28.1%
unpow-prod-down28.1%
clear-num28.2%
associate-/l*28.0%
div-inv28.0%
associate-/r/28.1%
frac-times59.6%
*-commutative59.6%
associate-*l*59.4%
Applied egg-rr59.4%
unpow1/259.4%
associate-*r*59.6%
*-commutative59.6%
*-commutative59.6%
associate-*r/54.5%
associate-/l*59.7%
Simplified59.7%
Final simplification88.7%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) 0.0)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 5e+279)
(* c0 (* (sqrt A) (pow (* V l) -0.5)))
(sqrt (* A (/ (/ c0 V) (/ l c0)))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= 0.0) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
} else {
tmp = sqrt((A * ((c0 / V) / (l / c0))));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this 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 ((v * l) <= 0.0d0) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else if ((v * l) <= 5d+279) then
tmp = c0 * (sqrt(a) * ((v * l) ** (-0.5d0)))
else
tmp = sqrt((a * ((c0 / v) / (l / c0))))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= 0.0) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
} else {
tmp = Math.sqrt((A * ((c0 / V) / (l / c0))));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= 0.0: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 5e+279: tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5)) else: tmp = math.sqrt((A * ((c0 / V) / (l / c0)))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= 0.0) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 5e+279) tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5))); else tmp = sqrt(Float64(A * Float64(Float64(c0 / V) / Float64(l / c0)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= 0.0)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 5e+279)
tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
else
tmp = sqrt((A * ((c0 / V) / (l / c0))));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+279], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(A * N[(N[(c0 / V), $MachinePrecision] / N[(l / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+279}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A \cdot \frac{\frac{c0}{V}}{\frac{\ell}{c0}}}\\
\end{array}
\end{array}
if (*.f64 V l) < 0.0Initial program 71.6%
associate-/r*76.5%
sqrt-div44.1%
Applied egg-rr44.1%
if 0.0 < (*.f64 V l) < 5.0000000000000002e279Initial program 89.0%
div-inv88.6%
sqrt-prod98.5%
pow1/298.5%
inv-pow98.5%
pow-pow98.9%
metadata-eval98.9%
Applied egg-rr98.9%
if 5.0000000000000002e279 < (*.f64 V l) Initial program 29.6%
associate-/r*36.2%
div-inv36.2%
Applied egg-rr36.2%
un-div-inv36.2%
Applied egg-rr36.2%
add-sqr-sqrt12.1%
sqrt-prod28.1%
pow1/228.1%
pow1/228.1%
associate-/l/28.0%
*-commutative28.0%
associate-/l/28.1%
unpow-prod-down28.1%
clear-num28.2%
associate-/l*28.0%
div-inv28.0%
associate-/r/28.1%
frac-times59.6%
*-commutative59.6%
associate-*l*59.4%
Applied egg-rr59.4%
unpow1/259.4%
associate-*r*59.6%
*-commutative59.6%
*-commutative59.6%
associate-*r/54.5%
associate-/l*59.7%
Simplified59.7%
Final simplification67.3%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) 0.0)
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) 5e+279)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(sqrt (* A (/ (/ c0 V) (/ l c0)))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= 0.0) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = sqrt((A * ((c0 / V) / (l / c0))));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this 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 ((v * l) <= 0.0d0) then
tmp = c0 * (sqrt((a / v)) / sqrt(l))
else if ((v * l) <= 5d+279) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = sqrt((a * ((c0 / v) / (l / c0))))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= 0.0) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= 5e+279) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = Math.sqrt((A * ((c0 / V) / (l / c0))));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= 0.0: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= 5e+279: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = math.sqrt((A * ((c0 / V) / (l / c0)))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= 0.0) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= 5e+279) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = sqrt(Float64(A * Float64(Float64(c0 / V) / Float64(l / c0)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= 0.0)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= 5e+279)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = sqrt((A * ((c0 / V) / (l / c0))));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+279], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Sqrt[N[(A * N[(N[(c0 / V), $MachinePrecision] / N[(l / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq 0:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+279}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\sqrt{A \cdot \frac{\frac{c0}{V}}{\frac{\ell}{c0}}}\\
\end{array}
\end{array}
if (*.f64 V l) < 0.0Initial program 71.6%
associate-/r*76.5%
sqrt-div44.1%
Applied egg-rr44.1%
if 0.0 < (*.f64 V l) < 5.0000000000000002e279Initial program 89.0%
sqrt-div98.8%
associate-*r/96.2%
Applied egg-rr96.2%
*-commutative96.2%
associate-*l/98.8%
Simplified98.8%
if 5.0000000000000002e279 < (*.f64 V l) Initial program 29.6%
associate-/r*36.2%
div-inv36.2%
Applied egg-rr36.2%
un-div-inv36.2%
Applied egg-rr36.2%
add-sqr-sqrt12.1%
sqrt-prod28.1%
pow1/228.1%
pow1/228.1%
associate-/l/28.0%
*-commutative28.0%
associate-/l/28.1%
unpow-prod-down28.1%
clear-num28.2%
associate-/l*28.0%
div-inv28.0%
associate-/r/28.1%
frac-times59.6%
*-commutative59.6%
associate-*l*59.4%
Applied egg-rr59.4%
unpow1/259.4%
associate-*r*59.6%
*-commutative59.6%
*-commutative59.6%
associate-*r/54.5%
associate-/l*59.7%
Simplified59.7%
Final simplification67.3%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l -5e-310) (* c0 (pow (/ (* V l) A) -0.5)) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -5e-310) {
tmp = c0 * pow(((V * l) / A), -0.5);
} else {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this 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 (l <= (-5d-310)) then
tmp = c0 * (((v * l) / a) ** (-0.5d0))
else
tmp = c0 * (sqrt((a / v)) / sqrt(l))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (l <= -5e-310) {
tmp = c0 * Math.pow(((V * l) / A), -0.5);
} else {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if l <= -5e-310: tmp = c0 * math.pow(((V * l) / A), -0.5) else: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (l <= -5e-310) tmp = Float64(c0 * (Float64(Float64(V * l) / A) ^ -0.5)); else tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (l <= -5e-310)
tmp = c0 * (((V * l) / A) ^ -0.5);
else
tmp = c0 * (sqrt((A / V)) / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[l, -5e-310], N[(c0 * N[Power[N[(N[(V * l), $MachinePrecision] / A), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5 \cdot 10^{-310}:\\
\;\;\;\;c0 \cdot {\left(\frac{V \cdot \ell}{A}\right)}^{-0.5}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < -4.999999999999985e-310Initial program 80.9%
pow1/280.9%
clear-num80.9%
inv-pow80.9%
pow-pow80.9%
associate-/l*82.8%
metadata-eval82.8%
Applied egg-rr82.8%
associate-/l*80.9%
Simplified80.9%
if -4.999999999999985e-310 < l Initial program 70.8%
associate-/r*70.6%
sqrt-div84.3%
Applied egg-rr84.3%
Final simplification82.7%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (/ A (* V l))))
(if (<= t_0 0.0)
(sqrt (* A (/ (/ c0 V) (/ l c0))))
(if (<= t_0 1e+304) (* c0 (sqrt t_0)) (* c0 (pow (* V (/ l A)) -0.5))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = sqrt((A * ((c0 / V) / (l / c0))));
} else if (t_0 <= 1e+304) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 * pow((V * (l / A)), -0.5);
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this 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 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = sqrt((a * ((c0 / v) / (l / c0))))
else if (t_0 <= 1d+304) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 * ((v * (l / a)) ** (-0.5d0))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = Math.sqrt((A * ((c0 / V) / (l / c0))));
} else if (t_0 <= 1e+304) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 * Math.pow((V * (l / A)), -0.5);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = math.sqrt((A * ((c0 / V) / (l / c0)))) elif t_0 <= 1e+304: tmp = c0 * math.sqrt(t_0) else: tmp = c0 * math.pow((V * (l / A)), -0.5) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = sqrt(Float64(A * Float64(Float64(c0 / V) / Float64(l / c0)))); elseif (t_0 <= 1e+304) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 * (Float64(V * Float64(l / A)) ^ -0.5)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = sqrt((A * ((c0 / V) / (l / c0))));
elseif (t_0 <= 1e+304)
tmp = c0 * sqrt(t_0);
else
tmp = c0 * ((V * (l / A)) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[Sqrt[N[(A * N[(N[(c0 / V), $MachinePrecision] / N[(l / c0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 1e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Power[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\sqrt{A \cdot \frac{\frac{c0}{V}}{\frac{\ell}{c0}}}\\
\mathbf{elif}\;t_0 \leq 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 37.6%
associate-/r*43.7%
div-inv43.7%
Applied egg-rr43.7%
un-div-inv43.7%
Applied egg-rr43.7%
add-sqr-sqrt20.6%
sqrt-prod38.7%
pow1/238.7%
pow1/238.7%
associate-/l/36.8%
*-commutative36.8%
associate-/l/38.6%
unpow-prod-down36.8%
clear-num36.9%
associate-/l*36.8%
div-inv36.8%
associate-/r/42.4%
frac-times55.7%
*-commutative55.7%
associate-*l*58.5%
Applied egg-rr58.5%
unpow1/258.5%
associate-*r*55.7%
*-commutative55.7%
*-commutative55.7%
associate-*r/52.0%
associate-/l*55.8%
Simplified55.8%
if 0.0 < (/.f64 A (*.f64 V l)) < 9.9999999999999994e303Initial program 98.2%
if 9.9999999999999994e303 < (/.f64 A (*.f64 V l)) Initial program 44.9%
pow1/244.9%
clear-num44.9%
inv-pow44.9%
pow-pow46.7%
associate-/l*58.4%
metadata-eval58.4%
Applied egg-rr58.4%
associate-/l*46.7%
*-lft-identity46.7%
times-frac58.4%
/-rgt-identity58.4%
Simplified58.4%
Final simplification81.8%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (/ A (* V l))))
(if (<= t_0 0.0)
(sqrt (* (/ c0 V) (* A (/ c0 l))))
(if (<= t_0 1e+304) (* c0 (sqrt t_0)) (* c0 (pow (* V (/ l A)) -0.5))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = sqrt(((c0 / V) * (A * (c0 / l))));
} else if (t_0 <= 1e+304) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 * pow((V * (l / A)), -0.5);
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this 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 = a / (v * l)
if (t_0 <= 0.0d0) then
tmp = sqrt(((c0 / v) * (a * (c0 / l))))
else if (t_0 <= 1d+304) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 * ((v * (l / a)) ** (-0.5d0))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 0.0) {
tmp = Math.sqrt(((c0 / V) * (A * (c0 / l))));
} else if (t_0 <= 1e+304) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 * Math.pow((V * (l / A)), -0.5);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 0.0: tmp = math.sqrt(((c0 / V) * (A * (c0 / l)))) elif t_0 <= 1e+304: tmp = c0 * math.sqrt(t_0) else: tmp = c0 * math.pow((V * (l / A)), -0.5) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 0.0) tmp = sqrt(Float64(Float64(c0 / V) * Float64(A * Float64(c0 / l)))); elseif (t_0 <= 1e+304) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 * (Float64(V * Float64(l / A)) ^ -0.5)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 0.0)
tmp = sqrt(((c0 / V) * (A * (c0 / l))));
elseif (t_0 <= 1e+304)
tmp = c0 * sqrt(t_0);
else
tmp = c0 * ((V * (l / A)) ^ -0.5);
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 0.0], N[Sqrt[N[(N[(c0 / V), $MachinePrecision] * N[(A * N[(c0 / l), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[t$95$0, 1e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Power[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 0:\\
\;\;\;\;\sqrt{\frac{c0}{V} \cdot \left(A \cdot \frac{c0}{\ell}\right)}\\
\mathbf{elif}\;t_0 \leq 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot {\left(V \cdot \frac{\ell}{A}\right)}^{-0.5}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 37.6%
add-sqr-sqrt37.6%
sqrt-unprod37.6%
pow1/237.6%
*-commutative37.6%
*-commutative37.6%
swap-sqr36.8%
add-sqr-sqrt36.8%
Applied egg-rr36.8%
unpow1/236.8%
Simplified36.8%
*-commutative36.8%
clear-num36.8%
associate-*r/36.9%
un-div-inv36.9%
associate-*r/36.8%
Applied egg-rr36.8%
associate-/r/42.4%
frac-times55.7%
associate-*l*56.3%
Applied egg-rr56.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 9.9999999999999994e303Initial program 98.2%
if 9.9999999999999994e303 < (/.f64 A (*.f64 V l)) Initial program 44.9%
pow1/244.9%
clear-num44.9%
inv-pow44.9%
pow-pow46.7%
associate-/l*58.4%
metadata-eval58.4%
Applied egg-rr58.4%
associate-/l*46.7%
*-lft-identity46.7%
times-frac58.4%
/-rgt-identity58.4%
Simplified58.4%
Final simplification81.9%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= (* V l) 1e-264) (* c0 (sqrt (/ (/ A V) l))) (* c0 (sqrt (/ A (* V l))))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= 1e-264) {
tmp = c0 * sqrt(((A / V) / l));
} else {
tmp = c0 * sqrt((A / (V * l)));
}
return tmp;
}
NOTE: V and l should be sorted in increasing order before calling this 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 ((v * l) <= 1d-264) then
tmp = c0 * sqrt(((a / v) / l))
else
tmp = c0 * sqrt((a / (v * l)))
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= 1e-264) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else {
tmp = c0 * Math.sqrt((A / (V * l)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= 1e-264: tmp = c0 * math.sqrt(((A / V) / l)) else: tmp = c0 * math.sqrt((A / (V * l))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= 1e-264) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); else tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l)))); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= 1e-264)
tmp = c0 * sqrt(((A / V) / l));
else
tmp = c0 * sqrt((A / (V * l)));
end
tmp_2 = tmp;
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], 1e-264], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq 10^{-264}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < 1e-264Initial program 72.4%
associate-/r*77.5%
div-inv77.3%
Applied egg-rr77.3%
un-div-inv77.5%
Applied egg-rr77.5%
if 1e-264 < (*.f64 V l) Initial program 79.2%
Final simplification78.3%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (* c0 (sqrt (/ A (* V l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
NOTE: V and l should be sorted in increasing order before calling this 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
code = c0 * sqrt((a / (v * l)))
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
[V, l] = sort([V, l]) def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
V, l = sort([V, l]) function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
V, l = num2cell(sort([V, l])){:}
function tmp = code(c0, A, V, l)
tmp = c0 * sqrt((A / (V * l)));
end
NOTE: V and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Initial program 75.5%
Final simplification75.5%
herbie shell --seed 2023249
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))