
(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 9 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
(let* ((t_0 (sqrt (* V (/ l A)))))
(if (<= (* V l) (- INFINITY))
(* c0 (/ (sqrt (/ A V)) (sqrt l)))
(if (<= (* V l) -4e-323)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(/ c0 t_0)
(if (<= (* V l) 5e+232)
(* c0 (* (sqrt A) (pow (* V l) -0.5)))
(/ 1.0 (/ t_0 c0))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = sqrt((V * (l / A)));
double tmp;
if ((V * l) <= -((double) INFINITY)) {
tmp = c0 * (sqrt((A / V)) / sqrt(l));
} else if ((V * l) <= -4e-323) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / t_0;
} else if ((V * l) <= 5e+232) {
tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
} else {
tmp = 1.0 / (t_0 / c0);
}
return tmp;
}
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = Math.sqrt((V * (l / A)));
double tmp;
if ((V * l) <= -Double.POSITIVE_INFINITY) {
tmp = c0 * (Math.sqrt((A / V)) / Math.sqrt(l));
} else if ((V * l) <= -4e-323) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / t_0;
} else if ((V * l) <= 5e+232) {
tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
} else {
tmp = 1.0 / (t_0 / c0);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = math.sqrt((V * (l / A))) tmp = 0 if (V * l) <= -math.inf: tmp = c0 * (math.sqrt((A / V)) / math.sqrt(l)) elif (V * l) <= -4e-323: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 / t_0 elif (V * l) <= 5e+232: tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5)) else: tmp = 1.0 / (t_0 / c0) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = sqrt(Float64(V * Float64(l / A))) tmp = 0.0 if (Float64(V * l) <= Float64(-Inf)) tmp = Float64(c0 * Float64(sqrt(Float64(A / V)) / sqrt(l))); elseif (Float64(V * l) <= -4e-323) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 / t_0); elseif (Float64(V * l) <= 5e+232) tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5))); else tmp = Float64(1.0 / Float64(t_0 / c0)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = sqrt((V * (l / A)));
tmp = 0.0;
if ((V * l) <= -Inf)
tmp = c0 * (sqrt((A / V)) / sqrt(l));
elseif ((V * l) <= -4e-323)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 / t_0;
elseif ((V * l) <= 5e+232)
tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
else
tmp = 1.0 / (t_0 / 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_] := Block[{t$95$0 = N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, 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], -4e-323], 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 / t$95$0), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+232], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(t$95$0 / c0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{V \cdot \frac{\ell}{A}}\\
\mathbf{if}\;V \cdot \ell \leq -\infty:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -4 \cdot 10^{-323}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{t_0}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+232}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{t_0}{c0}}\\
\end{array}
\end{array}
if (*.f64 V l) < -inf.0Initial program 29.2%
associate-/r*46.0%
sqrt-div26.5%
Applied egg-rr26.5%
if -inf.0 < (*.f64 V l) < -3.95253e-323Initial program 89.7%
frac-2neg89.7%
sqrt-div98.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
Applied egg-rr98.5%
if -3.95253e-323 < (*.f64 V l) < 0.0Initial program 42.7%
*-un-lft-identity42.7%
times-frac76.1%
Applied egg-rr76.1%
frac-times42.7%
*-un-lft-identity42.7%
sqrt-div12.5%
clear-num12.5%
div-inv12.5%
sqrt-undiv42.7%
*-un-lft-identity42.7%
times-frac76.2%
/-rgt-identity76.2%
Applied egg-rr76.2%
if 0.0 < (*.f64 V l) < 4.99999999999999987e232Initial program 83.4%
div-inv83.4%
sqrt-prod99.4%
pow1/299.4%
inv-pow99.4%
pow-pow99.4%
metadata-eval99.4%
Applied egg-rr99.4%
if 4.99999999999999987e232 < (*.f64 V l) Initial program 34.4%
*-un-lft-identity34.4%
times-frac79.8%
Applied egg-rr79.8%
*-commutative79.8%
frac-times34.4%
*-un-lft-identity34.4%
sqrt-div34.4%
clear-num34.5%
associate-/r/34.6%
sqrt-undiv34.6%
*-un-lft-identity34.6%
times-frac79.9%
/-rgt-identity79.9%
Applied egg-rr79.9%
Final simplification88.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 (sqrt (/ A V))))
(if (<= (* V l) -2e+254)
(* c0 (/ t_0 (sqrt l)))
(if (<= (* V l) -1e-105)
(* c0 (sqrt (/ A (* V l))))
(if (<= (* V l) 0.0)
(* t_0 (/ c0 (sqrt l)))
(if (<= (* V l) 5e+232)
(* c0 (* (sqrt A) (pow (* V l) -0.5)))
(/ 1.0 (/ (sqrt (* V (/ l A))) c0))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = sqrt((A / V));
double tmp;
if ((V * l) <= -2e+254) {
tmp = c0 * (t_0 / sqrt(l));
} else if ((V * l) <= -1e-105) {
tmp = c0 * sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = t_0 * (c0 / sqrt(l));
} else if ((V * l) <= 5e+232) {
tmp = c0 * (sqrt(A) * pow((V * l), -0.5));
} else {
tmp = 1.0 / (sqrt((V * (l / A))) / 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) :: t_0
real(8) :: tmp
t_0 = sqrt((a / v))
if ((v * l) <= (-2d+254)) then
tmp = c0 * (t_0 / sqrt(l))
else if ((v * l) <= (-1d-105)) then
tmp = c0 * sqrt((a / (v * l)))
else if ((v * l) <= 0.0d0) then
tmp = t_0 * (c0 / sqrt(l))
else if ((v * l) <= 5d+232) then
tmp = c0 * (sqrt(a) * ((v * l) ** (-0.5d0)))
else
tmp = 1.0d0 / (sqrt((v * (l / a))) / c0)
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = Math.sqrt((A / V));
double tmp;
if ((V * l) <= -2e+254) {
tmp = c0 * (t_0 / Math.sqrt(l));
} else if ((V * l) <= -1e-105) {
tmp = c0 * Math.sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = t_0 * (c0 / Math.sqrt(l));
} else if ((V * l) <= 5e+232) {
tmp = c0 * (Math.sqrt(A) * Math.pow((V * l), -0.5));
} else {
tmp = 1.0 / (Math.sqrt((V * (l / A))) / c0);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = math.sqrt((A / V)) tmp = 0 if (V * l) <= -2e+254: tmp = c0 * (t_0 / math.sqrt(l)) elif (V * l) <= -1e-105: tmp = c0 * math.sqrt((A / (V * l))) elif (V * l) <= 0.0: tmp = t_0 * (c0 / math.sqrt(l)) elif (V * l) <= 5e+232: tmp = c0 * (math.sqrt(A) * math.pow((V * l), -0.5)) else: tmp = 1.0 / (math.sqrt((V * (l / A))) / c0) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = sqrt(Float64(A / V)) tmp = 0.0 if (Float64(V * l) <= -2e+254) tmp = Float64(c0 * Float64(t_0 / sqrt(l))); elseif (Float64(V * l) <= -1e-105) tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l)))); elseif (Float64(V * l) <= 0.0) tmp = Float64(t_0 * Float64(c0 / sqrt(l))); elseif (Float64(V * l) <= 5e+232) tmp = Float64(c0 * Float64(sqrt(A) * (Float64(V * l) ^ -0.5))); else tmp = Float64(1.0 / Float64(sqrt(Float64(V * Float64(l / A))) / c0)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = sqrt((A / V));
tmp = 0.0;
if ((V * l) <= -2e+254)
tmp = c0 * (t_0 / sqrt(l));
elseif ((V * l) <= -1e-105)
tmp = c0 * sqrt((A / (V * l)));
elseif ((V * l) <= 0.0)
tmp = t_0 * (c0 / sqrt(l));
elseif ((V * l) <= 5e+232)
tmp = c0 * (sqrt(A) * ((V * l) ^ -0.5));
else
tmp = 1.0 / (sqrt((V * (l / A))) / 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_] := Block[{t$95$0 = N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -2e+254], N[(c0 * N[(t$95$0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-105], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(t$95$0 * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+232], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Power[N[(V * l), $MachinePrecision], -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V}}\\
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+254}:\\
\;\;\;\;c0 \cdot \frac{t_0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-105}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;t_0 \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+232}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot {\left(V \cdot \ell\right)}^{-0.5}\right)\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{V \cdot \frac{\ell}{A}}}{c0}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1.9999999999999999e254Initial program 34.1%
associate-/r*47.4%
sqrt-div33.2%
Applied egg-rr33.2%
if -1.9999999999999999e254 < (*.f64 V l) < -9.99999999999999965e-106Initial program 95.3%
if -9.99999999999999965e-106 < (*.f64 V l) < 0.0Initial program 60.5%
*-un-lft-identity60.5%
times-frac75.3%
Applied egg-rr75.3%
*-commutative75.3%
frac-times60.5%
*-un-lft-identity60.5%
sqrt-div6.8%
clear-num6.8%
associate-/r/6.8%
sqrt-undiv60.5%
*-un-lft-identity60.5%
times-frac75.3%
/-rgt-identity75.3%
Applied egg-rr75.3%
associate-/r/75.2%
associate-*l/75.4%
*-lft-identity75.4%
*-commutative75.4%
associate-*l/60.5%
associate-/l*77.2%
Simplified77.2%
*-un-lft-identity77.2%
associate-*l/77.0%
metadata-eval77.0%
sqrt-div77.2%
clear-num77.2%
associate-/r*60.5%
sqrt-undiv6.8%
associate-*l/6.8%
sqrt-prod13.6%
times-frac11.8%
sqrt-div47.3%
Applied egg-rr47.3%
if 0.0 < (*.f64 V l) < 4.99999999999999987e232Initial program 83.4%
div-inv83.4%
sqrt-prod99.4%
pow1/299.4%
inv-pow99.4%
pow-pow99.4%
metadata-eval99.4%
Applied egg-rr99.4%
if 4.99999999999999987e232 < (*.f64 V l) Initial program 34.4%
*-un-lft-identity34.4%
times-frac79.8%
Applied egg-rr79.8%
*-commutative79.8%
frac-times34.4%
*-un-lft-identity34.4%
sqrt-div34.4%
clear-num34.5%
associate-/r/34.6%
sqrt-undiv34.6%
*-un-lft-identity34.6%
times-frac79.9%
/-rgt-identity79.9%
Applied egg-rr79.9%
Final simplification78.9%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (sqrt (/ A V))))
(if (<= (* V l) -2e+254)
(* c0 (/ t_0 (sqrt l)))
(if (<= (* V l) -1e-105)
(* c0 (sqrt (/ A (* V l))))
(if (<= (* V l) 0.0)
(* t_0 (/ c0 (sqrt l)))
(if (<= (* V l) 5e+232)
(* (sqrt A) (/ c0 (sqrt (* V l))))
(/ 1.0 (/ (sqrt (* V (/ l A))) c0))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = sqrt((A / V));
double tmp;
if ((V * l) <= -2e+254) {
tmp = c0 * (t_0 / sqrt(l));
} else if ((V * l) <= -1e-105) {
tmp = c0 * sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = t_0 * (c0 / sqrt(l));
} else if ((V * l) <= 5e+232) {
tmp = sqrt(A) * (c0 / sqrt((V * l)));
} else {
tmp = 1.0 / (sqrt((V * (l / A))) / 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) :: t_0
real(8) :: tmp
t_0 = sqrt((a / v))
if ((v * l) <= (-2d+254)) then
tmp = c0 * (t_0 / sqrt(l))
else if ((v * l) <= (-1d-105)) then
tmp = c0 * sqrt((a / (v * l)))
else if ((v * l) <= 0.0d0) then
tmp = t_0 * (c0 / sqrt(l))
else if ((v * l) <= 5d+232) then
tmp = sqrt(a) * (c0 / sqrt((v * l)))
else
tmp = 1.0d0 / (sqrt((v * (l / a))) / c0)
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = Math.sqrt((A / V));
double tmp;
if ((V * l) <= -2e+254) {
tmp = c0 * (t_0 / Math.sqrt(l));
} else if ((V * l) <= -1e-105) {
tmp = c0 * Math.sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = t_0 * (c0 / Math.sqrt(l));
} else if ((V * l) <= 5e+232) {
tmp = Math.sqrt(A) * (c0 / Math.sqrt((V * l)));
} else {
tmp = 1.0 / (Math.sqrt((V * (l / A))) / c0);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = math.sqrt((A / V)) tmp = 0 if (V * l) <= -2e+254: tmp = c0 * (t_0 / math.sqrt(l)) elif (V * l) <= -1e-105: tmp = c0 * math.sqrt((A / (V * l))) elif (V * l) <= 0.0: tmp = t_0 * (c0 / math.sqrt(l)) elif (V * l) <= 5e+232: tmp = math.sqrt(A) * (c0 / math.sqrt((V * l))) else: tmp = 1.0 / (math.sqrt((V * (l / A))) / c0) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = sqrt(Float64(A / V)) tmp = 0.0 if (Float64(V * l) <= -2e+254) tmp = Float64(c0 * Float64(t_0 / sqrt(l))); elseif (Float64(V * l) <= -1e-105) tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l)))); elseif (Float64(V * l) <= 0.0) tmp = Float64(t_0 * Float64(c0 / sqrt(l))); elseif (Float64(V * l) <= 5e+232) tmp = Float64(sqrt(A) * Float64(c0 / sqrt(Float64(V * l)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(V * Float64(l / A))) / c0)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = sqrt((A / V));
tmp = 0.0;
if ((V * l) <= -2e+254)
tmp = c0 * (t_0 / sqrt(l));
elseif ((V * l) <= -1e-105)
tmp = c0 * sqrt((A / (V * l)));
elseif ((V * l) <= 0.0)
tmp = t_0 * (c0 / sqrt(l));
elseif ((V * l) <= 5e+232)
tmp = sqrt(A) * (c0 / sqrt((V * l)));
else
tmp = 1.0 / (sqrt((V * (l / A))) / 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_] := Block[{t$95$0 = N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -2e+254], N[(c0 * N[(t$95$0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-105], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(t$95$0 * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+232], N[(N[Sqrt[A], $MachinePrecision] * N[(c0 / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V}}\\
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+254}:\\
\;\;\;\;c0 \cdot \frac{t_0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-105}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;t_0 \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+232}:\\
\;\;\;\;\sqrt{A} \cdot \frac{c0}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{V \cdot \frac{\ell}{A}}}{c0}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1.9999999999999999e254Initial program 34.1%
associate-/r*47.4%
sqrt-div33.2%
Applied egg-rr33.2%
if -1.9999999999999999e254 < (*.f64 V l) < -9.99999999999999965e-106Initial program 95.3%
if -9.99999999999999965e-106 < (*.f64 V l) < 0.0Initial program 60.5%
*-un-lft-identity60.5%
times-frac75.3%
Applied egg-rr75.3%
*-commutative75.3%
frac-times60.5%
*-un-lft-identity60.5%
sqrt-div6.8%
clear-num6.8%
associate-/r/6.8%
sqrt-undiv60.5%
*-un-lft-identity60.5%
times-frac75.3%
/-rgt-identity75.3%
Applied egg-rr75.3%
associate-/r/75.2%
associate-*l/75.4%
*-lft-identity75.4%
*-commutative75.4%
associate-*l/60.5%
associate-/l*77.2%
Simplified77.2%
*-un-lft-identity77.2%
associate-*l/77.0%
metadata-eval77.0%
sqrt-div77.2%
clear-num77.2%
associate-/r*60.5%
sqrt-undiv6.8%
associate-*l/6.8%
sqrt-prod13.6%
times-frac11.8%
sqrt-div47.3%
Applied egg-rr47.3%
if 0.0 < (*.f64 V l) < 4.99999999999999987e232Initial program 83.4%
sqrt-div99.3%
associate-*r/95.2%
Applied egg-rr95.2%
associate-*l/97.2%
Simplified97.2%
if 4.99999999999999987e232 < (*.f64 V l) Initial program 34.4%
*-un-lft-identity34.4%
times-frac79.8%
Applied egg-rr79.8%
*-commutative79.8%
frac-times34.4%
*-un-lft-identity34.4%
sqrt-div34.4%
clear-num34.5%
associate-/r/34.6%
sqrt-undiv34.6%
*-un-lft-identity34.6%
times-frac79.9%
/-rgt-identity79.9%
Applied egg-rr79.9%
Final simplification78.2%
NOTE: V and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (sqrt (/ A V))))
(if (<= (* V l) -2e+254)
(* c0 (/ t_0 (sqrt l)))
(if (<= (* V l) -1e-105)
(* c0 (sqrt (/ A (* V l))))
(if (<= (* V l) 0.0)
(* t_0 (/ c0 (sqrt l)))
(if (<= (* V l) 5e+232)
(* c0 (/ (sqrt A) (sqrt (* V l))))
(/ 1.0 (/ (sqrt (* V (/ l A))) c0))))))))assert(V < l);
double code(double c0, double A, double V, double l) {
double t_0 = sqrt((A / V));
double tmp;
if ((V * l) <= -2e+254) {
tmp = c0 * (t_0 / sqrt(l));
} else if ((V * l) <= -1e-105) {
tmp = c0 * sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = t_0 * (c0 / sqrt(l));
} else if ((V * l) <= 5e+232) {
tmp = c0 * (sqrt(A) / sqrt((V * l)));
} else {
tmp = 1.0 / (sqrt((V * (l / A))) / 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) :: t_0
real(8) :: tmp
t_0 = sqrt((a / v))
if ((v * l) <= (-2d+254)) then
tmp = c0 * (t_0 / sqrt(l))
else if ((v * l) <= (-1d-105)) then
tmp = c0 * sqrt((a / (v * l)))
else if ((v * l) <= 0.0d0) then
tmp = t_0 * (c0 / sqrt(l))
else if ((v * l) <= 5d+232) then
tmp = c0 * (sqrt(a) / sqrt((v * l)))
else
tmp = 1.0d0 / (sqrt((v * (l / a))) / c0)
end if
code = tmp
end function
assert V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = Math.sqrt((A / V));
double tmp;
if ((V * l) <= -2e+254) {
tmp = c0 * (t_0 / Math.sqrt(l));
} else if ((V * l) <= -1e-105) {
tmp = c0 * Math.sqrt((A / (V * l)));
} else if ((V * l) <= 0.0) {
tmp = t_0 * (c0 / Math.sqrt(l));
} else if ((V * l) <= 5e+232) {
tmp = c0 * (Math.sqrt(A) / Math.sqrt((V * l)));
} else {
tmp = 1.0 / (Math.sqrt((V * (l / A))) / c0);
}
return tmp;
}
[V, l] = sort([V, l]) def code(c0, A, V, l): t_0 = math.sqrt((A / V)) tmp = 0 if (V * l) <= -2e+254: tmp = c0 * (t_0 / math.sqrt(l)) elif (V * l) <= -1e-105: tmp = c0 * math.sqrt((A / (V * l))) elif (V * l) <= 0.0: tmp = t_0 * (c0 / math.sqrt(l)) elif (V * l) <= 5e+232: tmp = c0 * (math.sqrt(A) / math.sqrt((V * l))) else: tmp = 1.0 / (math.sqrt((V * (l / A))) / c0) return tmp
V, l = sort([V, l]) function code(c0, A, V, l) t_0 = sqrt(Float64(A / V)) tmp = 0.0 if (Float64(V * l) <= -2e+254) tmp = Float64(c0 * Float64(t_0 / sqrt(l))); elseif (Float64(V * l) <= -1e-105) tmp = Float64(c0 * sqrt(Float64(A / Float64(V * l)))); elseif (Float64(V * l) <= 0.0) tmp = Float64(t_0 * Float64(c0 / sqrt(l))); elseif (Float64(V * l) <= 5e+232) tmp = Float64(c0 * Float64(sqrt(A) / sqrt(Float64(V * l)))); else tmp = Float64(1.0 / Float64(sqrt(Float64(V * Float64(l / A))) / c0)); end return tmp end
V, l = num2cell(sort([V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = sqrt((A / V));
tmp = 0.0;
if ((V * l) <= -2e+254)
tmp = c0 * (t_0 / sqrt(l));
elseif ((V * l) <= -1e-105)
tmp = c0 * sqrt((A / (V * l)));
elseif ((V * l) <= 0.0)
tmp = t_0 * (c0 / sqrt(l));
elseif ((V * l) <= 5e+232)
tmp = c0 * (sqrt(A) / sqrt((V * l)));
else
tmp = 1.0 / (sqrt((V * (l / A))) / 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_] := Block[{t$95$0 = N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(V * l), $MachinePrecision], -2e+254], N[(c0 * N[(t$95$0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-105], N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(t$95$0 * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 5e+232], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] / N[Sqrt[N[(V * l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(1.0 / N[(N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / c0), $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
[V, l] = \mathsf{sort}([V, l])\\
\\
\begin{array}{l}
t_0 := \sqrt{\frac{A}{V}}\\
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+254}:\\
\;\;\;\;c0 \cdot \frac{t_0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-105}:\\
\;\;\;\;c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;t_0 \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq 5 \cdot 10^{+232}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{A}}{\sqrt{V \cdot \ell}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{V \cdot \frac{\ell}{A}}}{c0}}\\
\end{array}
\end{array}
if (*.f64 V l) < -1.9999999999999999e254Initial program 34.1%
associate-/r*47.4%
sqrt-div33.2%
Applied egg-rr33.2%
if -1.9999999999999999e254 < (*.f64 V l) < -9.99999999999999965e-106Initial program 95.3%
if -9.99999999999999965e-106 < (*.f64 V l) < 0.0Initial program 60.5%
*-un-lft-identity60.5%
times-frac75.3%
Applied egg-rr75.3%
*-commutative75.3%
frac-times60.5%
*-un-lft-identity60.5%
sqrt-div6.8%
clear-num6.8%
associate-/r/6.8%
sqrt-undiv60.5%
*-un-lft-identity60.5%
times-frac75.3%
/-rgt-identity75.3%
Applied egg-rr75.3%
associate-/r/75.2%
associate-*l/75.4%
*-lft-identity75.4%
*-commutative75.4%
associate-*l/60.5%
associate-/l*77.2%
Simplified77.2%
*-un-lft-identity77.2%
associate-*l/77.0%
metadata-eval77.0%
sqrt-div77.2%
clear-num77.2%
associate-/r*60.5%
sqrt-undiv6.8%
associate-*l/6.8%
sqrt-prod13.6%
times-frac11.8%
sqrt-div47.3%
Applied egg-rr47.3%
if 0.0 < (*.f64 V l) < 4.99999999999999987e232Initial program 83.4%
sqrt-div99.3%
associate-*r/95.2%
Applied egg-rr95.2%
*-commutative95.2%
associate-*l/99.3%
Simplified99.3%
if 4.99999999999999987e232 < (*.f64 V l) Initial program 34.4%
*-un-lft-identity34.4%
times-frac79.8%
Applied egg-rr79.8%
*-commutative79.8%
frac-times34.4%
*-un-lft-identity34.4%
sqrt-div34.4%
clear-num34.5%
associate-/r/34.6%
sqrt-undiv34.6%
*-un-lft-identity34.6%
times-frac79.9%
/-rgt-identity79.9%
Applied egg-rr79.9%
Final simplification78.9%
NOTE: V and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= l 8.5e-305) (/ 1.0 (/ (sqrt (* V (/ l A))) c0)) (* c0 (/ (sqrt (/ A V)) (sqrt l)))))
assert(V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (l <= 8.5e-305) {
tmp = 1.0 / (sqrt((V * (l / A))) / c0);
} 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 <= 8.5d-305) then
tmp = 1.0d0 / (sqrt((v * (l / a))) / c0)
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 <= 8.5e-305) {
tmp = 1.0 / (Math.sqrt((V * (l / A))) / c0);
} 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 <= 8.5e-305: tmp = 1.0 / (math.sqrt((V * (l / A))) / c0) 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 <= 8.5e-305) tmp = Float64(1.0 / Float64(sqrt(Float64(V * Float64(l / A))) / c0)); 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 <= 8.5e-305)
tmp = 1.0 / (sqrt((V * (l / A))) / c0);
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, 8.5e-305], N[(1.0 / N[(N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] / c0), $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 8.5 \cdot 10^{-305}:\\
\;\;\;\;\frac{1}{\frac{\sqrt{V \cdot \frac{\ell}{A}}}{c0}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{\frac{A}{V}}}{\sqrt{\ell}}\\
\end{array}
\end{array}
if l < 8.4999999999999997e-305Initial program 72.0%
*-un-lft-identity72.0%
times-frac70.5%
Applied egg-rr70.5%
*-commutative70.5%
frac-times72.0%
*-un-lft-identity72.0%
sqrt-div44.4%
clear-num44.4%
associate-/r/44.4%
sqrt-undiv72.5%
*-un-lft-identity72.5%
times-frac71.0%
/-rgt-identity71.0%
Applied egg-rr71.0%
if 8.4999999999999997e-305 < l Initial program 73.9%
associate-/r*80.0%
sqrt-div87.9%
Applied egg-rr87.9%
Final simplification79.3%
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 1e+275)))
(* 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 <= 1e+275)) {
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 <= 1d+275))) 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 <= 1e+275)) {
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 <= 1e+275): 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 <= 1e+275)) 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 <= 1e+275)))
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, 1e+275]], $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 10^{+275}\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 9.9999999999999996e274 < (/.f64 A (*.f64 V l)) Initial program 38.0%
*-un-lft-identity38.0%
times-frac58.0%
Applied egg-rr58.0%
frac-times38.0%
*-un-lft-identity38.0%
associate-/r*57.1%
Applied egg-rr57.1%
if 0.0 < (/.f64 A (*.f64 V l)) < 9.9999999999999996e274Initial program 98.8%
Final simplification81.0%
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 1e+281) (* 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 <= 1e+281) {
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 <= 1d+281) 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 <= 1e+281) {
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 <= 1e+281: 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 <= 1e+281) 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 <= 1e+281)
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, 1e+281], 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 10^{+281}:\\
\;\;\;\;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 27.8%
*-un-lft-identity27.8%
times-frac51.3%
Applied egg-rr51.3%
frac-times27.8%
*-un-lft-identity27.8%
associate-/r*51.3%
Applied egg-rr51.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 1e281Initial program 98.8%
if 1e281 < (/.f64 A (*.f64 V l)) Initial program 46.7%
*-un-lft-identity46.7%
times-frac63.6%
Applied egg-rr63.6%
frac-times46.7%
*-un-lft-identity46.7%
sqrt-div33.4%
clear-num33.4%
div-inv33.5%
sqrt-undiv47.8%
*-un-lft-identity47.8%
times-frac64.9%
/-rgt-identity64.9%
Applied egg-rr64.9%
Final simplification81.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)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 1e+275) (* 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 <= 1e+275) {
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 <= 1d+275) 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 <= 1e+275) {
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 <= 1e+275: 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 <= 1e+275) 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 <= 1e+275)
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, 1e+275], 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 10^{+275}:\\
\;\;\;\;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 27.8%
*-un-lft-identity27.8%
times-frac51.3%
Applied egg-rr51.3%
frac-times27.8%
*-un-lft-identity27.8%
associate-/r*51.3%
Applied egg-rr51.3%
if 0.0 < (/.f64 A (*.f64 V l)) < 9.9999999999999996e274Initial program 98.8%
if 9.9999999999999996e274 < (/.f64 A (*.f64 V l)) Initial program 47.6%
*-un-lft-identity47.6%
times-frac64.3%
Applied egg-rr64.3%
*-commutative64.3%
frac-times47.6%
*-un-lft-identity47.6%
sqrt-div32.9%
clear-num32.8%
associate-/r/32.8%
sqrt-undiv48.8%
*-un-lft-identity48.8%
times-frac65.5%
/-rgt-identity65.5%
Applied egg-rr65.5%
associate-/r/65.4%
associate-*l/65.5%
*-lft-identity65.5%
*-commutative65.5%
associate-*l/48.8%
associate-/l*62.6%
Simplified62.6%
Taylor expanded in l around 0 48.8%
associate-*l/64.2%
*-commutative64.2%
Simplified64.2%
Final simplification81.4%
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 72.9%
Final simplification72.9%
herbie shell --seed 2023228
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))