
(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 10 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) -1e+133)
(* (* (sqrt (/ A V)) (sqrt (/ 1.0 l))) c0)
(if (<= (* V l) -5e-315)
(* c0 (/ (sqrt (- A)) (sqrt (* l (- V)))))
(if (<= (* V l) 0.0)
(/ 1.0 (/ (sqrt (* V (/ l A))) c0))
(if (<= (* V l) 1e+294)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* c0 (sqrt (* (/ 1.0 V) (/ A l)))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -1e+133) {
tmp = (sqrt((A / V)) * sqrt((1.0 / l))) * c0;
} else if ((V * l) <= -5e-315) {
tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
} else if ((V * l) <= 0.0) {
tmp = 1.0 / (sqrt((V * (l / A))) / c0);
} else if ((V * l) <= 1e+294) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = c0 * sqrt(((1.0 / V) * (A / 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+133)) then
tmp = (sqrt((a / v)) * sqrt((1.0d0 / l))) * c0
else if ((v * l) <= (-5d-315)) then
tmp = c0 * (sqrt(-a) / sqrt((l * -v)))
else if ((v * l) <= 0.0d0) then
tmp = 1.0d0 / (sqrt((v * (l / a))) / c0)
else if ((v * l) <= 1d+294) then
tmp = c0 / (sqrt((v * l)) / sqrt(a))
else
tmp = c0 * sqrt(((1.0d0 / v) * (a / 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+133) {
tmp = (Math.sqrt((A / V)) * Math.sqrt((1.0 / l))) * c0;
} else if ((V * l) <= -5e-315) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((l * -V)));
} else if ((V * l) <= 0.0) {
tmp = 1.0 / (Math.sqrt((V * (l / A))) / c0);
} else if ((V * l) <= 1e+294) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = c0 * Math.sqrt(((1.0 / V) * (A / l)));
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -1e+133: tmp = (math.sqrt((A / V)) * math.sqrt((1.0 / l))) * c0 elif (V * l) <= -5e-315: tmp = c0 * (math.sqrt(-A) / math.sqrt((l * -V))) elif (V * l) <= 0.0: tmp = 1.0 / (math.sqrt((V * (l / A))) / c0) elif (V * l) <= 1e+294: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = c0 * math.sqrt(((1.0 / V) * (A / l))) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -1e+133) tmp = Float64(Float64(sqrt(Float64(A / V)) * sqrt(Float64(1.0 / l))) * c0); elseif (Float64(V * l) <= -5e-315) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(l * Float64(-V))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(1.0 / Float64(sqrt(Float64(V * Float64(l / A))) / c0)); elseif (Float64(V * l) <= 1e+294) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / V) * Float64(A / 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+133)
tmp = (sqrt((A / V)) * sqrt((1.0 / l))) * c0;
elseif ((V * l) <= -5e-315)
tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
elseif ((V * l) <= 0.0)
tmp = 1.0 / (sqrt((V * (l / A))) / c0);
elseif ((V * l) <= 1e+294)
tmp = c0 / (sqrt((V * l)) / sqrt(A));
else
tmp = c0 * sqrt(((1.0 / V) * (A / 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+133], N[(N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[Sqrt[N[(1.0 / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * c0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-315], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(l * (-V)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(1.0 / N[(N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+294], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] * N[(A / l), $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^{+133}:\\
\;\;\;\;\left(\sqrt{\frac{A}{V}} \cdot \sqrt{\frac{1}{\ell}}\right) \cdot c0\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-315}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{1}{\frac{\sqrt{V \cdot \frac{\ell}{A}}}{c0}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+294}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1e133Initial program 71.9%
add-sqr-sqrt71.8%
pow271.8%
pow1/271.8%
sqrt-pow171.8%
metadata-eval71.8%
Applied egg-rr71.8%
Taylor expanded in c0 around 0 71.9%
associate-/r*79.8%
Simplified79.8%
div-inv79.8%
sqrt-prod70.6%
Applied egg-rr70.6%
if -1e133 < (*.f64 V l) < -5.0000000023e-315Initial program 90.4%
frac-2neg90.4%
sqrt-div99.0%
*-commutative99.0%
distribute-rgt-neg-in99.0%
Applied egg-rr99.0%
if -5.0000000023e-315 < (*.f64 V l) < 0.0Initial program 45.8%
add-sqr-sqrt45.8%
pow245.8%
pow1/245.8%
sqrt-pow145.8%
metadata-eval45.8%
Applied egg-rr45.8%
pow-pow45.8%
metadata-eval45.8%
pow1/245.8%
sqrt-div19.8%
associate-*r/19.7%
associate-*l/19.8%
associate-/r/19.8%
sqrt-undiv45.8%
associate-*r/76.0%
clear-num76.0%
Applied egg-rr76.0%
if 0.0 < (*.f64 V l) < 1.00000000000000007e294Initial program 85.4%
sqrt-div99.5%
associate-*r/98.9%
Applied egg-rr98.9%
associate-/l*99.5%
Simplified99.5%
if 1.00000000000000007e294 < (*.f64 V l) Initial program 42.1%
*-un-lft-identity42.1%
times-frac75.0%
Applied egg-rr75.0%
Final simplification91.8%
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 V)) (sqrt l)))
(if (<= (* V l) -5e-114)
(* c0 (sqrt (/ A (* V l))))
(if (<= (* V l) 0.0)
(/ c0 (sqrt (* V (/ l A))))
(if (<= (* V l) 1e+294)
(* (sqrt A) (/ c0 (sqrt (* V l))))
(* c0 (sqrt (* (/ 1.0 V) (/ A 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 / V)) / sqrt(l));
} else if ((V * l) <= -5e-114) {
tmp = c0 * sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / sqrt((V * (l / A)));
} else if ((V * l) <= 1e+294) {
tmp = sqrt(A) * (c0 / sqrt((V * l)));
} else {
tmp = c0 * sqrt(((1.0 / V) * (A / 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 / V)) / Math.sqrt(l));
} else if ((V * l) <= -5e-114) {
tmp = c0 * Math.sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / Math.sqrt((V * (l / A)));
} else if ((V * l) <= 1e+294) {
tmp = Math.sqrt(A) * (c0 / Math.sqrt((V * l)));
} else {
tmp = c0 * Math.sqrt(((1.0 / V) * (A / 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 / V)) / math.sqrt(l)) elif (V * l) <= -5e-114: tmp = c0 * math.sqrt((A / (V * l))) elif (V * l) <= 0.0: tmp = c0 / math.sqrt((V * (l / A))) elif (V * l) <= 1e+294: tmp = math.sqrt(A) * (c0 / math.sqrt((V * l))) else: tmp = c0 * math.sqrt(((1.0 / V) * (A / 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(A / V)) / sqrt(l))); elseif (Float64(V * l) <= -5e-114) tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l)))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); elseif (Float64(V * l) <= 1e+294) tmp = Float64(sqrt(A) * Float64(c0 / sqrt(Float64(V * l)))); else tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / V) * Float64(A / 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 / V)) / sqrt(l));
elseif ((V * l) <= -5e-114)
tmp = c0 * sqrt((A / (V * l)));
elseif ((V * l) <= 0.0)
tmp = c0 / sqrt((V * (l / A)));
elseif ((V * l) <= 1e+294)
tmp = sqrt(A) * (c0 / sqrt((V * l)));
else
tmp = c0 * sqrt(((1.0 / V) * (A / 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 / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-114], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+294], N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] * N[(A / l), $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}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-114}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+294}:\\
\;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 33.1%
associate-/r*51.9%
sqrt-div69.3%
Applied egg-rr69.3%
if -inf.0 < (*.f64 V l) < -4.99999999999999989e-114Initial program 97.0%
if -4.99999999999999989e-114 < (*.f64 V l) < 0.0Initial program 61.2%
add-sqr-sqrt61.0%
pow261.0%
pow1/261.0%
sqrt-pow161.1%
metadata-eval61.1%
Applied egg-rr61.1%
pow-pow61.2%
metadata-eval61.2%
pow1/261.2%
sqrt-div10.3%
associate-*r/10.2%
associate-*l/10.3%
associate-/r/10.3%
sqrt-undiv62.4%
associate-*r/74.5%
Applied egg-rr74.5%
if 0.0 < (*.f64 V l) < 1.00000000000000007e294Initial program 85.4%
sqrt-div99.5%
associate-*r/98.9%
Applied egg-rr98.9%
associate-*l/99.4%
Simplified99.4%
if 1.00000000000000007e294 < (*.f64 V l) Initial program 42.1%
*-un-lft-identity42.1%
times-frac75.0%
Applied egg-rr75.0%
Final simplification90.0%
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 V)) (sqrt l)))
(if (<= (* V l) -5e-114)
(* c0 (sqrt (/ A (* V l))))
(if (<= (* V l) 0.0)
(/ c0 (sqrt (* V (/ l A))))
(if (<= (* V l) 1e+294)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* c0 (sqrt (* (/ 1.0 V) (/ A 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 / V)) / sqrt(l));
} else if ((V * l) <= -5e-114) {
tmp = c0 * sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / sqrt((V * (l / A)));
} else if ((V * l) <= 1e+294) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = c0 * sqrt(((1.0 / V) * (A / 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 / V)) / Math.sqrt(l));
} else if ((V * l) <= -5e-114) {
tmp = c0 * Math.sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / Math.sqrt((V * (l / A)));
} else if ((V * l) <= 1e+294) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = c0 * Math.sqrt(((1.0 / V) * (A / 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 / V)) / math.sqrt(l)) elif (V * l) <= -5e-114: tmp = c0 * math.sqrt((A / (V * l))) elif (V * l) <= 0.0: tmp = c0 / math.sqrt((V * (l / A))) elif (V * l) <= 1e+294: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = c0 * math.sqrt(((1.0 / V) * (A / 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(A / V)) / sqrt(l))); elseif (Float64(V * l) <= -5e-114) tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l)))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); elseif (Float64(V * l) <= 1e+294) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / V) * Float64(A / 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 / V)) / sqrt(l));
elseif ((V * l) <= -5e-114)
tmp = c0 * sqrt((A / (V * l)));
elseif ((V * l) <= 0.0)
tmp = c0 / sqrt((V * (l / A)));
elseif ((V * l) <= 1e+294)
tmp = c0 / (sqrt((V * l)) / sqrt(A));
else
tmp = c0 * sqrt(((1.0 / V) * (A / 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 / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-114], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+294], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] * N[(A / l), $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}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-114}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+294}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 33.1%
associate-/r*51.9%
sqrt-div69.3%
Applied egg-rr69.3%
if -inf.0 < (*.f64 V l) < -4.99999999999999989e-114Initial program 97.0%
if -4.99999999999999989e-114 < (*.f64 V l) < 0.0Initial program 61.2%
add-sqr-sqrt61.0%
pow261.0%
pow1/261.0%
sqrt-pow161.1%
metadata-eval61.1%
Applied egg-rr61.1%
pow-pow61.2%
metadata-eval61.2%
pow1/261.2%
sqrt-div10.3%
associate-*r/10.2%
associate-*l/10.3%
associate-/r/10.3%
sqrt-undiv62.4%
associate-*r/74.5%
Applied egg-rr74.5%
if 0.0 < (*.f64 V l) < 1.00000000000000007e294Initial program 85.4%
sqrt-div99.5%
associate-*r/98.9%
Applied egg-rr98.9%
associate-/l*99.5%
Simplified99.5%
if 1.00000000000000007e294 < (*.f64 V l) Initial program 42.1%
*-un-lft-identity42.1%
times-frac75.0%
Applied egg-rr75.0%
Final simplification90.1%
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 V)) (sqrt l)))
(if (<= (* V l) -5e-315)
(* c0 (/ (sqrt (- A)) (sqrt (* l (- V)))))
(if (<= (* V l) 0.0)
(/ 1.0 (/ (sqrt (* V (/ l A))) c0))
(if (<= (* V l) 1e+294)
(/ c0 (/ (sqrt (* V l)) (sqrt A)))
(* c0 (sqrt (* (/ 1.0 V) (/ A 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 / V)) / sqrt(l));
} else if ((V * l) <= -5e-315) {
tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
} else if ((V * l) <= 0.0) {
tmp = 1.0 / (sqrt((V * (l / A))) / c0);
} else if ((V * l) <= 1e+294) {
tmp = c0 / (sqrt((V * l)) / sqrt(A));
} else {
tmp = c0 * sqrt(((1.0 / V) * (A / 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 / V)) / Math.sqrt(l));
} else if ((V * l) <= -5e-315) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((l * -V)));
} else if ((V * l) <= 0.0) {
tmp = 1.0 / (Math.sqrt((V * (l / A))) / c0);
} else if ((V * l) <= 1e+294) {
tmp = c0 / (Math.sqrt((V * l)) / Math.sqrt(A));
} else {
tmp = c0 * Math.sqrt(((1.0 / V) * (A / 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 / V)) / math.sqrt(l)) elif (V * l) <= -5e-315: tmp = c0 * (math.sqrt(-A) / math.sqrt((l * -V))) elif (V * l) <= 0.0: tmp = 1.0 / (math.sqrt((V * (l / A))) / c0) elif (V * l) <= 1e+294: tmp = c0 / (math.sqrt((V * l)) / math.sqrt(A)) else: tmp = c0 * math.sqrt(((1.0 / V) * (A / 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(A / V)) / sqrt(l))); elseif (Float64(V * l) <= -5e-315) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(l * Float64(-V))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(1.0 / Float64(sqrt(Float64(V * Float64(l / A))) / c0)); elseif (Float64(V * l) <= 1e+294) tmp = Float64(c0 / Float64(sqrt(Float64(V * l)) / sqrt(A))); else tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / V) * Float64(A / 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 / V)) / sqrt(l));
elseif ((V * l) <= -5e-315)
tmp = c0 * (sqrt(-A) / sqrt((l * -V)));
elseif ((V * l) <= 0.0)
tmp = 1.0 / (sqrt((V * (l / A))) / c0);
elseif ((V * l) <= 1e+294)
tmp = c0 / (sqrt((V * l)) / sqrt(A));
else
tmp = c0 * sqrt(((1.0 / V) * (A / 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 / V), $MachinePrecision]], $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-315], N[(c0 * N[(N[Sqrt[(-A)], $MachinePrecision] / N[Sqrt[N[(l * (-V)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(1.0 / N[(N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 1e+294], N[(c0 / N[(N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision] / N[Sqrt[A], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] * N[(A / l), $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}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-315}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{\ell \cdot \left(-V\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{1}{\frac{\sqrt{V \cdot \frac{\ell}{A}}}{c0}}\\
\mathbf{elif}\;V \cdot \ell \leq 10^{+294}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{V \cdot \ell}}{\sqrt{A}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 33.1%
associate-/r*51.9%
sqrt-div69.3%
Applied egg-rr69.3%
if -inf.0 < (*.f64 V l) < -5.0000000023e-315Initial program 91.8%
frac-2neg91.8%
sqrt-div99.1%
*-commutative99.1%
distribute-rgt-neg-in99.1%
Applied egg-rr99.1%
if -5.0000000023e-315 < (*.f64 V l) < 0.0Initial program 45.8%
add-sqr-sqrt45.8%
pow245.8%
pow1/245.8%
sqrt-pow145.8%
metadata-eval45.8%
Applied egg-rr45.8%
pow-pow45.8%
metadata-eval45.8%
pow1/245.8%
sqrt-div19.8%
associate-*r/19.7%
associate-*l/19.8%
associate-/r/19.8%
sqrt-undiv45.8%
associate-*r/76.0%
clear-num76.0%
Applied egg-rr76.0%
if 0.0 < (*.f64 V l) < 1.00000000000000007e294Initial program 85.4%
sqrt-div99.5%
associate-*r/98.9%
Applied egg-rr98.9%
associate-/l*99.5%
Simplified99.5%
if 1.00000000000000007e294 < (*.f64 V l) Initial program 42.1%
*-un-lft-identity42.1%
times-frac75.0%
Applied egg-rr75.0%
Final simplification93.3%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l 3e-309) (* c0 (sqrt (* (/ 1.0 V) (/ A l)))) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= 3e-309) {
tmp = c0 * sqrt(((1.0 / V) * (A / l)));
} 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 <= 3d-309) then
tmp = c0 * sqrt(((1.0d0 / v) * (a / l)))
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 <= 3e-309) {
tmp = c0 * Math.sqrt(((1.0 / V) * (A / l)));
} 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 <= 3e-309: tmp = c0 * math.sqrt(((1.0 / V) * (A / l))) 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 <= 3e-309) tmp = Float64(c0 * sqrt(Float64(Float64(1.0 / V) * Float64(A / l)))); 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 <= 3e-309)
tmp = c0 * sqrt(((1.0 / V) * (A / l)));
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, 3e-309], N[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] * N[(A / l), $MachinePrecision]), $MachinePrecision]], $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 3 \cdot 10^{-309}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 3.000000000000001e-309Initial program 78.1%
*-un-lft-identity78.1%
times-frac75.8%
Applied egg-rr75.8%
if 3.000000000000001e-309 < l Initial program 76.7%
associate-/r*72.1%
sqrt-div84.0%
Applied egg-rr84.0%
Final simplification80.1%
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 (or (<= t_0 0.0) (not (<= t_0 5e+304)))
(* c0 (sqrt (/ (/ A V) l)))
(* c0 (sqrt t_0)))))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) || !(t_0 <= 5e+304)) {
tmp = c0 * sqrt(((A / V) / l));
} else {
tmp = c0 * sqrt(t_0);
}
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) .or. (.not. (t_0 <= 5d+304))) then
tmp = c0 * sqrt(((a / v) / l))
else
tmp = c0 * sqrt(t_0)
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) || !(t_0 <= 5e+304)) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else {
tmp = c0 * Math.sqrt(t_0);
}
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) or not (t_0 <= 5e+304): tmp = c0 * math.sqrt(((A / V) / l)) else: tmp = c0 * math.sqrt(t_0) 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) || !(t_0 <= 5e+304)) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); else tmp = Float64(c0 * sqrt(t_0)); 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) || ~((t_0 <= 5e+304)))
tmp = c0 * sqrt(((A / V) / l));
else
tmp = c0 * sqrt(t_0);
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[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 5e+304]], $MachinePrecision]], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[t$95$0], $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 \lor \neg \left(t_0 \leq 5 \cdot 10^{+304}\right):\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0 or 4.9999999999999997e304 < (/.f64 A (*.f64 V l)) Initial program 40.8%
add-sqr-sqrt40.8%
pow240.8%
pow1/240.8%
sqrt-pow140.8%
metadata-eval40.8%
Applied egg-rr40.8%
Taylor expanded in c0 around 0 40.8%
associate-/r*59.8%
Simplified59.8%
if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999997e304Initial program 99.3%
Final simplification84.5%
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)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 2e+295) (* c0 (sqrt t_0)) (/ c0 (sqrt (* V (/ l A))))))))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 = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 2e+295) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / sqrt((V * (l / A)));
}
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 = c0 * sqrt(((a / v) / l))
else if (t_0 <= 2d+295) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / sqrt((v * (l / a)))
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 = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 2e+295) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / Math.sqrt((V * (l / A)));
}
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 = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 2e+295: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / math.sqrt((V * (l / A))) 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 = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 2e+295) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); 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 = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 2e+295)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / sqrt((V * (l / A)));
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[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+295], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $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:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+295}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 37.1%
add-sqr-sqrt37.1%
pow237.1%
pow1/237.1%
sqrt-pow137.1%
metadata-eval37.1%
Applied egg-rr37.1%
Taylor expanded in c0 around 0 37.1%
associate-/r*57.5%
Simplified57.5%
if 0.0 < (/.f64 A (*.f64 V l)) < 2e295Initial program 99.3%
if 2e295 < (/.f64 A (*.f64 V l)) Initial program 46.7%
add-sqr-sqrt46.7%
pow246.7%
pow1/246.7%
sqrt-pow146.7%
metadata-eval46.7%
Applied egg-rr46.7%
pow-pow46.7%
metadata-eval46.7%
pow1/246.7%
sqrt-div37.0%
associate-*r/36.9%
associate-*l/37.0%
associate-/r/37.0%
sqrt-undiv48.9%
associate-*r/63.9%
Applied egg-rr63.9%
Final simplification84.6%
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)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 5e+304) (* c0 (sqrt t_0)) (/ c0 (sqrt (* l (/ V A))))))))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 = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 5e+304) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / sqrt((l * (V / A)));
}
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 = c0 * sqrt(((a / v) / l))
else if (t_0 <= 5d+304) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / sqrt((l * (v / a)))
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 = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 5e+304) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / Math.sqrt((l * (V / A)));
}
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 = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 5e+304: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / math.sqrt((l * (V / A))) 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 = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); elseif (t_0 <= 5e+304) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A)))); 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 = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 5e+304)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / sqrt((l * (V / A)));
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[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $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:\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 37.1%
add-sqr-sqrt37.1%
pow237.1%
pow1/237.1%
sqrt-pow137.1%
metadata-eval37.1%
Applied egg-rr37.1%
Taylor expanded in c0 around 0 37.1%
associate-/r*57.5%
Simplified57.5%
if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999997e304Initial program 99.3%
if 4.9999999999999997e304 < (/.f64 A (*.f64 V l)) Initial program 44.5%
add-sqr-sqrt44.5%
pow244.5%
pow1/244.5%
sqrt-pow144.5%
metadata-eval44.5%
Applied egg-rr44.5%
pow-pow44.5%
metadata-eval44.5%
pow1/244.5%
sqrt-div34.3%
associate-*r/34.3%
associate-*l/34.4%
associate-/r/34.3%
sqrt-undiv46.8%
associate-*r/64.4%
Applied egg-rr64.4%
associate-*r/46.8%
associate-*l/63.5%
*-commutative63.5%
Simplified63.5%
Final simplification84.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)
(* c0 (sqrt (* (/ 1.0 V) (/ A l))))
(if (<= t_0 5e+304) (* c0 (sqrt t_0)) (/ c0 (sqrt (* l (/ V A))))))))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 = c0 * sqrt(((1.0 / V) * (A / l)));
} else if (t_0 <= 5e+304) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / sqrt((l * (V / A)));
}
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 = c0 * sqrt(((1.0d0 / v) * (a / l)))
else if (t_0 <= 5d+304) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / sqrt((l * (v / a)))
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 = c0 * Math.sqrt(((1.0 / V) * (A / l)));
} else if (t_0 <= 5e+304) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / Math.sqrt((l * (V / A)));
}
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 = c0 * math.sqrt(((1.0 / V) * (A / l))) elif t_0 <= 5e+304: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / math.sqrt((l * (V / A))) 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 = Float64(c0 * sqrt(Float64(Float64(1.0 / V) * Float64(A / l)))); elseif (t_0 <= 5e+304) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / sqrt(Float64(l * Float64(V / A)))); 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 = c0 * sqrt(((1.0 / V) * (A / l)));
elseif (t_0 <= 5e+304)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / sqrt((l * (V / A)));
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[(c0 * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] * N[(A / l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 5e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[Sqrt[N[(l * N[(V / A), $MachinePrecision]), $MachinePrecision]], $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:\\
\;\;\;\;c0 \cdot \sqrt{\frac{1}{V} \cdot \frac{A}{\ell}}\\
\mathbf{elif}\;t_0 \leq 5 \cdot 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell \cdot \frac{V}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 0.0Initial program 37.1%
*-un-lft-identity37.1%
times-frac57.5%
Applied egg-rr57.5%
if 0.0 < (/.f64 A (*.f64 V l)) < 4.9999999999999997e304Initial program 99.3%
if 4.9999999999999997e304 < (/.f64 A (*.f64 V l)) Initial program 44.5%
add-sqr-sqrt44.5%
pow244.5%
pow1/244.5%
sqrt-pow144.5%
metadata-eval44.5%
Applied egg-rr44.5%
pow-pow44.5%
metadata-eval44.5%
pow1/244.5%
sqrt-div34.3%
associate-*r/34.3%
associate-*l/34.4%
associate-/r/34.3%
sqrt-undiv46.8%
associate-*r/64.4%
Applied egg-rr64.4%
associate-*r/46.8%
associate-*l/63.5%
*-commutative63.5%
Simplified63.5%
Final simplification84.7%
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 77.4%
Final simplification77.4%
herbie shell --seed 2023223
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))