
(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: c0, A, V, and l should be sorted in increasing order before calling this function. (FPCore (c0 A V l) :precision binary64 (if (<= A -2e-310) (/ c0 (* (/ (sqrt (- V)) (sqrt (- A))) (sqrt l))) (* c0 (* (sqrt A) (sqrt (/ (/ 1.0 V) l))))))
assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if (A <= -2e-310) {
tmp = c0 / ((sqrt(-V) / sqrt(-A)) * sqrt(l));
} else {
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
}
return tmp;
}
NOTE: c0, A, 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 (a <= (-2d-310)) then
tmp = c0 / ((sqrt(-v) / sqrt(-a)) * sqrt(l))
else
tmp = c0 * (sqrt(a) * sqrt(((1.0d0 / v) / l)))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if (A <= -2e-310) {
tmp = c0 / ((Math.sqrt(-V) / Math.sqrt(-A)) * Math.sqrt(l));
} else {
tmp = c0 * (Math.sqrt(A) * Math.sqrt(((1.0 / V) / l)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if A <= -2e-310: tmp = c0 / ((math.sqrt(-V) / math.sqrt(-A)) * math.sqrt(l)) else: tmp = c0 * (math.sqrt(A) * math.sqrt(((1.0 / V) / l))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (A <= -2e-310) tmp = Float64(c0 / Float64(Float64(sqrt(Float64(-V)) / sqrt(Float64(-A))) * sqrt(l))); else tmp = Float64(c0 * Float64(sqrt(A) * sqrt(Float64(Float64(1.0 / V) / l)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if (A <= -2e-310)
tmp = c0 / ((sqrt(-V) / sqrt(-A)) * sqrt(l));
else
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[A, -2e-310], N[(c0 / N[(N[(N[Sqrt[(-V)], $MachinePrecision] / N[Sqrt[(-A)], $MachinePrecision]), $MachinePrecision] * N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;A \leq -2 \cdot 10^{-310}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{-V}}{\sqrt{-A}} \cdot \sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\
\end{array}
\end{array}
if A < -1.999999999999994e-310Initial program 71.9%
*-un-lft-identity71.9%
times-frac72.7%
Applied egg-rr72.7%
frac-times71.9%
*-un-lft-identity71.9%
*-un-lft-identity71.9%
*-commutative71.9%
times-frac72.7%
sqrt-unprod41.2%
*-commutative41.2%
expm1-log1p-u32.4%
expm1-udef14.3%
Applied egg-rr28.0%
expm1-def59.4%
expm1-log1p72.8%
Simplified72.8%
*-commutative72.8%
sqrt-prod42.9%
Applied egg-rr42.9%
frac-2neg42.9%
sqrt-div49.0%
Applied egg-rr49.0%
if -1.999999999999994e-310 < A Initial program 80.0%
div-inv80.0%
sqrt-prod87.8%
associate-/r*87.9%
Applied egg-rr87.9%
Final simplification65.7%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (* c0 (sqrt (/ A (* V l))))))
(if (or (<= t_0 0.0) (not (<= t_0 1e+251)))
(* c0 (sqrt (/ (/ A V) l)))
t_0)))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * sqrt((A / (V * l)));
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 1e+251)) {
tmp = c0 * sqrt(((A / V) / l));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: c0, A, 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 = c0 * sqrt((a / (v * l)))
if ((t_0 <= 0.0d0) .or. (.not. (t_0 <= 1d+251))) then
tmp = c0 * sqrt(((a / v) / l))
else
tmp = t_0
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 * Math.sqrt((A / (V * l)));
double tmp;
if ((t_0 <= 0.0) || !(t_0 <= 1e+251)) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else {
tmp = t_0;
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 * math.sqrt((A / (V * l))) tmp = 0 if (t_0 <= 0.0) or not (t_0 <= 1e+251): tmp = c0 * math.sqrt(((A / V) / l)) else: tmp = t_0 return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 * sqrt(Float64(A / Float64(V * l)))) tmp = 0.0 if ((t_0 <= 0.0) || !(t_0 <= 1e+251)) tmp = Float64(c0 * sqrt(Float64(Float64(A / V) / l))); else tmp = t_0; end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 * sqrt((A / (V * l)));
tmp = 0.0;
if ((t_0 <= 0.0) || ~((t_0 <= 1e+251)))
tmp = c0 * sqrt(((A / V) / l));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[t$95$0, 0.0], N[Not[LessEqual[t$95$0, 1e+251]], $MachinePrecision]], N[(c0 * N[Sqrt[N[(N[(A / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{if}\;t_0 \leq 0 \lor \neg \left(t_0 \leq 10^{+251}\right):\\
\;\;\;\;c0 \cdot \sqrt{\frac{\frac{A}{V}}{\ell}}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 0.0 or 1e251 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 66.5%
*-commutative66.5%
associate-/l/73.1%
Simplified73.1%
if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1e251Initial program 98.5%
Final simplification80.2%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (* c0 (sqrt (/ A (* V l))))))
(if (<= t_0 0.0)
(* c0 (sqrt (/ (/ A V) l)))
(if (<= t_0 2e+211) t_0 (/ c0 (sqrt (* V (/ l A))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * sqrt((A / (V * l)));
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * sqrt(((A / V) / l));
} else if (t_0 <= 2e+211) {
tmp = t_0;
} else {
tmp = c0 / sqrt((V * (l / A)));
}
return tmp;
}
NOTE: c0, A, 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 = c0 * sqrt((a / (v * l)))
if (t_0 <= 0.0d0) then
tmp = c0 * sqrt(((a / v) / l))
else if (t_0 <= 2d+211) then
tmp = t_0
else
tmp = c0 / sqrt((v * (l / a)))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 * Math.sqrt((A / (V * l)));
double tmp;
if (t_0 <= 0.0) {
tmp = c0 * Math.sqrt(((A / V) / l));
} else if (t_0 <= 2e+211) {
tmp = t_0;
} else {
tmp = c0 / Math.sqrt((V * (l / A)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 * math.sqrt((A / (V * l))) tmp = 0 if t_0 <= 0.0: tmp = c0 * math.sqrt(((A / V) / l)) elif t_0 <= 2e+211: tmp = t_0 else: tmp = c0 / math.sqrt((V * (l / A))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 * sqrt(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+211) tmp = t_0; else tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 * sqrt((A / (V * l)));
tmp = 0.0;
if (t_0 <= 0.0)
tmp = c0 * sqrt(((A / V) / l));
elseif (t_0 <= 2e+211)
tmp = t_0;
else
tmp = c0 / sqrt((V * (l / A)));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $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+211], t$95$0, N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\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^{+211}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 0.0Initial program 68.5%
*-commutative68.5%
associate-/l/75.4%
Simplified75.4%
if 0.0 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.9999999999999999e211Initial program 98.4%
if 1.9999999999999999e211 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 61.9%
*-un-lft-identity61.9%
times-frac66.6%
Applied egg-rr66.6%
frac-times61.9%
*-un-lft-identity61.9%
*-un-lft-identity61.9%
*-commutative61.9%
times-frac66.7%
sqrt-unprod35.2%
*-commutative35.2%
expm1-log1p-u33.2%
expm1-udef30.6%
Applied egg-rr63.8%
expm1-def63.8%
expm1-log1p66.6%
*-commutative66.6%
associate-*l/62.7%
associate-*r/67.6%
Simplified67.6%
Final simplification80.3%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(let* ((t_0 (* c0 (sqrt (/ A (* V l))))))
(if (<= t_0 1e-306)
(/ c0 (/ 1.0 (sqrt (/ (/ A l) V))))
(if (<= t_0 2e+211) t_0 (/ c0 (sqrt (* V (/ l A))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = c0 * sqrt((A / (V * l)));
double tmp;
if (t_0 <= 1e-306) {
tmp = c0 / (1.0 / sqrt(((A / l) / V)));
} else if (t_0 <= 2e+211) {
tmp = t_0;
} else {
tmp = c0 / sqrt((V * (l / A)));
}
return tmp;
}
NOTE: c0, A, 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 = c0 * sqrt((a / (v * l)))
if (t_0 <= 1d-306) then
tmp = c0 / (1.0d0 / sqrt(((a / l) / v)))
else if (t_0 <= 2d+211) then
tmp = t_0
else
tmp = c0 / sqrt((v * (l / a)))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = c0 * Math.sqrt((A / (V * l)));
double tmp;
if (t_0 <= 1e-306) {
tmp = c0 / (1.0 / Math.sqrt(((A / l) / V)));
} else if (t_0 <= 2e+211) {
tmp = t_0;
} else {
tmp = c0 / Math.sqrt((V * (l / A)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = c0 * math.sqrt((A / (V * l))) tmp = 0 if t_0 <= 1e-306: tmp = c0 / (1.0 / math.sqrt(((A / l) / V))) elif t_0 <= 2e+211: tmp = t_0 else: tmp = c0 / math.sqrt((V * (l / A))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(c0 * sqrt(Float64(A / Float64(V * l)))) tmp = 0.0 if (t_0 <= 1e-306) tmp = Float64(c0 / Float64(1.0 / sqrt(Float64(Float64(A / l) / V)))); elseif (t_0 <= 2e+211) tmp = t_0; else tmp = Float64(c0 / sqrt(Float64(V * Float64(l / A)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = c0 * sqrt((A / (V * l)));
tmp = 0.0;
if (t_0 <= 1e-306)
tmp = c0 / (1.0 / sqrt(((A / l) / V)));
elseif (t_0 <= 2e+211)
tmp = t_0;
else
tmp = c0 / sqrt((V * (l / A)));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
code[c0_, A_, V_, l_] := Block[{t$95$0 = N[(c0 * N[Sqrt[N[(A / N[(V * l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$0, 1e-306], N[(c0 / N[(1.0 / N[Sqrt[N[(N[(A / l), $MachinePrecision] / V), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+211], t$95$0, N[(c0 / N[Sqrt[N[(V * N[(l / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}\\
\mathbf{if}\;t_0 \leq 10^{-306}:\\
\;\;\;\;\frac{c0}{\frac{1}{\sqrt{\frac{\frac{A}{\ell}}{V}}}}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+211}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{V \cdot \frac{\ell}{A}}}\\
\end{array}
\end{array}
if (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.00000000000000003e-306Initial program 68.7%
*-un-lft-identity68.7%
times-frac72.4%
Applied egg-rr72.4%
frac-times68.7%
*-un-lft-identity68.7%
*-un-lft-identity68.7%
*-commutative68.7%
times-frac75.5%
sqrt-unprod47.7%
*-commutative47.7%
expm1-log1p-u27.4%
expm1-udef8.9%
Applied egg-rr15.4%
expm1-def44.0%
expm1-log1p74.8%
Simplified74.8%
*-commutative74.8%
associate-*l/68.5%
associate-/l*72.3%
Applied egg-rr72.3%
associate-/r/74.8%
sqrt-unprod48.3%
*-commutative48.3%
sqrt-prod74.8%
clear-num74.8%
div-inv74.8%
clear-num74.5%
sqrt-div75.5%
metadata-eval75.5%
associate-/l/68.6%
*-commutative68.6%
Applied egg-rr68.6%
*-commutative68.6%
associate-/r*72.3%
Simplified72.3%
if 1.00000000000000003e-306 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) < 1.9999999999999999e211Initial program 98.4%
if 1.9999999999999999e211 < (*.f64 c0 (sqrt.f64 (/.f64 A (*.f64 V l)))) Initial program 61.9%
*-un-lft-identity61.9%
times-frac66.6%
Applied egg-rr66.6%
frac-times61.9%
*-un-lft-identity61.9%
*-un-lft-identity61.9%
*-commutative61.9%
times-frac66.7%
sqrt-unprod35.2%
*-commutative35.2%
expm1-log1p-u33.2%
expm1-udef30.6%
Applied egg-rr63.8%
expm1-def63.8%
expm1-log1p66.6%
*-commutative66.6%
associate-*l/62.7%
associate-*r/67.6%
Simplified67.6%
Final simplification78.4%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) -2e+187)
(* (sqrt (/ A V)) (/ c0 (sqrt l)))
(if (<= (* V l) -1e-166)
(/ c0 (sqrt (* (* V l) (/ 1.0 A))))
(if (<= (* V l) 0.0)
(/ (/ c0 (sqrt (/ V A))) (sqrt l))
(* c0 (* (sqrt A) (sqrt (/ (/ 1.0 V) l))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -2e+187) {
tmp = sqrt((A / V)) * (c0 / sqrt(l));
} else if ((V * l) <= -1e-166) {
tmp = c0 / sqrt(((V * l) * (1.0 / A)));
} else if ((V * l) <= 0.0) {
tmp = (c0 / sqrt((V / A))) / sqrt(l);
} else {
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
}
return tmp;
}
NOTE: c0, A, 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) <= (-2d+187)) then
tmp = sqrt((a / v)) * (c0 / sqrt(l))
else if ((v * l) <= (-1d-166)) then
tmp = c0 / sqrt(((v * l) * (1.0d0 / a)))
else if ((v * l) <= 0.0d0) then
tmp = (c0 / sqrt((v / a))) / sqrt(l)
else
tmp = c0 * (sqrt(a) * sqrt(((1.0d0 / v) / l)))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -2e+187) {
tmp = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
} else if ((V * l) <= -1e-166) {
tmp = c0 / Math.sqrt(((V * l) * (1.0 / A)));
} else if ((V * l) <= 0.0) {
tmp = (c0 / Math.sqrt((V / A))) / Math.sqrt(l);
} else {
tmp = c0 * (Math.sqrt(A) * Math.sqrt(((1.0 / V) / l)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -2e+187: tmp = math.sqrt((A / V)) * (c0 / math.sqrt(l)) elif (V * l) <= -1e-166: tmp = c0 / math.sqrt(((V * l) * (1.0 / A))) elif (V * l) <= 0.0: tmp = (c0 / math.sqrt((V / A))) / math.sqrt(l) else: tmp = c0 * (math.sqrt(A) * math.sqrt(((1.0 / V) / l))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -2e+187) tmp = Float64(sqrt(Float64(A / V)) * Float64(c0 / sqrt(l))); elseif (Float64(V * l) <= -1e-166) tmp = Float64(c0 / sqrt(Float64(Float64(V * l) * Float64(1.0 / A)))); elseif (Float64(V * l) <= 0.0) tmp = Float64(Float64(c0 / sqrt(Float64(V / A))) / sqrt(l)); else tmp = Float64(c0 * Float64(sqrt(A) * sqrt(Float64(Float64(1.0 / V) / l)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= -2e+187)
tmp = sqrt((A / V)) * (c0 / sqrt(l));
elseif ((V * l) <= -1e-166)
tmp = c0 / sqrt(((V * l) * (1.0 / A)));
elseif ((V * l) <= 0.0)
tmp = (c0 / sqrt((V / A))) / sqrt(l);
else
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
end
tmp_2 = tmp;
end
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function. code[c0_, A_, V_, l_] := If[LessEqual[N[(V * l), $MachinePrecision], -2e+187], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -1e-166], N[(c0 / N[Sqrt[N[(N[(V * l), $MachinePrecision] * N[(1.0 / A), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], 0.0], N[(N[(c0 / N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] / N[Sqrt[l], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -2 \cdot 10^{+187}:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -1 \cdot 10^{-166}:\\
\;\;\;\;\frac{c0}{\sqrt{\left(V \cdot \ell\right) \cdot \frac{1}{A}}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{\frac{c0}{\sqrt{\frac{V}{A}}}}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\
\end{array}
\end{array}
if (*.f64 V l) < -1.99999999999999981e187Initial program 36.1%
*-un-lft-identity36.1%
times-frac63.0%
Applied egg-rr63.0%
*-commutative63.0%
frac-times36.1%
*-un-lft-identity36.1%
sqrt-div0.0%
associate-*l/0.0%
sqrt-prod0.0%
associate-/r*0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div41.1%
Applied egg-rr41.1%
*-commutative41.1%
associate-*r/44.0%
Simplified44.0%
if -1.99999999999999981e187 < (*.f64 V l) < -1.00000000000000004e-166Initial program 95.9%
*-un-lft-identity95.9%
times-frac82.5%
Applied egg-rr82.5%
frac-times95.9%
*-un-lft-identity95.9%
*-un-lft-identity95.9%
*-commutative95.9%
times-frac82.4%
sqrt-unprod41.1%
*-commutative41.1%
expm1-log1p-u35.3%
expm1-udef13.8%
Applied egg-rr26.3%
expm1-def71.5%
expm1-log1p84.4%
Simplified84.4%
associate-*r/96.4%
*-commutative96.4%
clear-num95.9%
Applied egg-rr95.9%
associate-/r/96.5%
Simplified96.5%
if -1.00000000000000004e-166 < (*.f64 V l) < -0.0Initial program 54.0%
*-commutative54.0%
associate-/r*65.8%
sqrt-div44.0%
associate-*l/44.0%
Applied egg-rr44.0%
*-commutative44.0%
clear-num44.0%
sqrt-div45.9%
metadata-eval45.9%
un-div-inv45.8%
Applied egg-rr45.8%
if -0.0 < (*.f64 V l) Initial program 83.0%
div-inv83.0%
sqrt-prod91.9%
associate-/r*92.0%
Applied egg-rr92.0%
Final simplification78.3%
NOTE: c0, A, V, and l should be sorted in increasing order before calling this function.
(FPCore (c0 A V l)
:precision binary64
(if (<= (* V l) -1e+270)
(* (sqrt (/ A V)) (/ c0 (sqrt l)))
(if (<= (* V l) -5e-322)
(* c0 (/ (sqrt (- A)) (sqrt (* V (- l)))))
(if (<= (* V l) 0.0)
(/ c0 (/ (sqrt (/ V A)) (pow l -0.5)))
(* c0 (* (sqrt A) (sqrt (/ (/ 1.0 V) l))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -1e+270) {
tmp = sqrt((A / V)) * (c0 / sqrt(l));
} else if ((V * l) <= -5e-322) {
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / (sqrt((V / A)) / pow(l, -0.5));
} else {
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
}
return tmp;
}
NOTE: c0, A, 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+270)) then
tmp = sqrt((a / v)) * (c0 / sqrt(l))
else if ((v * l) <= (-5d-322)) then
tmp = c0 * (sqrt(-a) / sqrt((v * -l)))
else if ((v * l) <= 0.0d0) then
tmp = c0 / (sqrt((v / a)) / (l ** (-0.5d0)))
else
tmp = c0 * (sqrt(a) * sqrt(((1.0d0 / v) / l)))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double tmp;
if ((V * l) <= -1e+270) {
tmp = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
} else if ((V * l) <= -5e-322) {
tmp = c0 * (Math.sqrt(-A) / Math.sqrt((V * -l)));
} else if ((V * l) <= 0.0) {
tmp = c0 / (Math.sqrt((V / A)) / Math.pow(l, -0.5));
} else {
tmp = c0 * (Math.sqrt(A) * Math.sqrt(((1.0 / V) / l)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): tmp = 0 if (V * l) <= -1e+270: tmp = math.sqrt((A / V)) * (c0 / math.sqrt(l)) elif (V * l) <= -5e-322: tmp = c0 * (math.sqrt(-A) / math.sqrt((V * -l))) elif (V * l) <= 0.0: tmp = c0 / (math.sqrt((V / A)) / math.pow(l, -0.5)) else: tmp = c0 * (math.sqrt(A) * math.sqrt(((1.0 / V) / l))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) tmp = 0.0 if (Float64(V * l) <= -1e+270) tmp = Float64(sqrt(Float64(A / V)) * Float64(c0 / sqrt(l))); elseif (Float64(V * l) <= -5e-322) tmp = Float64(c0 * Float64(sqrt(Float64(-A)) / sqrt(Float64(V * Float64(-l))))); elseif (Float64(V * l) <= 0.0) tmp = Float64(c0 / Float64(sqrt(Float64(V / A)) / (l ^ -0.5))); else tmp = Float64(c0 * Float64(sqrt(A) * sqrt(Float64(Float64(1.0 / V) / l)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
tmp = 0.0;
if ((V * l) <= -1e+270)
tmp = sqrt((A / V)) * (c0 / sqrt(l));
elseif ((V * l) <= -5e-322)
tmp = c0 * (sqrt(-A) / sqrt((V * -l)));
elseif ((V * l) <= 0.0)
tmp = c0 / (sqrt((V / A)) / (l ^ -0.5));
else
tmp = c0 * (sqrt(A) * sqrt(((1.0 / V) / l)));
end
tmp_2 = tmp;
end
NOTE: c0, A, 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+270], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[N[(V * l), $MachinePrecision], -5e-322], 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[(V / A), $MachinePrecision]], $MachinePrecision] / N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[(N[Sqrt[A], $MachinePrecision] * N[Sqrt[N[(N[(1.0 / V), $MachinePrecision] / l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
\mathbf{if}\;V \cdot \ell \leq -1 \cdot 10^{+270}:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;V \cdot \ell \leq -5 \cdot 10^{-322}:\\
\;\;\;\;c0 \cdot \frac{\sqrt{-A}}{\sqrt{V \cdot \left(-\ell\right)}}\\
\mathbf{elif}\;V \cdot \ell \leq 0:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\frac{V}{A}}}{{\ell}^{-0.5}}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \left(\sqrt{A} \cdot \sqrt{\frac{\frac{1}{V}}{\ell}}\right)\\
\end{array}
\end{array}
if (*.f64 V l) < -1e270Initial program 33.5%
*-un-lft-identity33.5%
times-frac67.9%
Applied egg-rr67.9%
*-commutative67.9%
frac-times33.5%
*-un-lft-identity33.5%
sqrt-div0.0%
associate-*l/0.0%
sqrt-prod0.0%
associate-/r*0.0%
*-commutative0.0%
associate-*r/0.0%
sqrt-div36.5%
Applied egg-rr36.5%
*-commutative36.5%
associate-*r/40.2%
Simplified40.2%
if -1e270 < (*.f64 V l) < -4.99006e-322Initial program 88.6%
frac-2neg88.6%
sqrt-div98.5%
distribute-rgt-neg-in98.5%
Applied egg-rr98.5%
distribute-rgt-neg-out98.5%
*-commutative98.5%
distribute-rgt-neg-in98.5%
Simplified98.5%
if -4.99006e-322 < (*.f64 V l) < -0.0Initial program 49.0%
pow1/249.0%
associate-/r*64.2%
div-inv64.2%
unpow-prod-down45.9%
pow1/245.9%
Applied egg-rr45.9%
unpow1/245.9%
Simplified45.9%
clear-num45.9%
sqrt-div48.4%
metadata-eval48.4%
Applied egg-rr48.4%
associate-*l/48.4%
*-un-lft-identity48.4%
associate-*r/48.3%
inv-pow48.3%
sqrt-pow148.3%
metadata-eval48.3%
Applied egg-rr48.3%
associate-/l*48.4%
Simplified48.4%
if -0.0 < (*.f64 V l) Initial program 83.0%
div-inv83.0%
sqrt-prod91.9%
associate-/r*92.0%
Applied egg-rr92.0%
Final simplification83.1%
NOTE: c0, A, 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 5e-317)
(* (sqrt (/ A V)) (/ c0 (sqrt l)))
(if (<= t_0 1e+306)
(* c0 (sqrt t_0))
(/ c0 (/ (sqrt (/ V A)) (pow l -0.5)))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 5e-317) {
tmp = sqrt((A / V)) * (c0 / sqrt(l));
} else if (t_0 <= 1e+306) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / (sqrt((V / A)) / pow(l, -0.5));
}
return tmp;
}
NOTE: c0, A, 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 <= 5d-317) then
tmp = sqrt((a / v)) * (c0 / sqrt(l))
else if (t_0 <= 1d+306) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / (sqrt((v / a)) / (l ** (-0.5d0)))
end if
code = tmp
end function
assert c0 < A && A < V && 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 <= 5e-317) {
tmp = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
} else if (t_0 <= 1e+306) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / (Math.sqrt((V / A)) / Math.pow(l, -0.5));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 5e-317: tmp = math.sqrt((A / V)) * (c0 / math.sqrt(l)) elif t_0 <= 1e+306: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / (math.sqrt((V / A)) / math.pow(l, -0.5)) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 5e-317) tmp = Float64(sqrt(Float64(A / V)) * Float64(c0 / sqrt(l))); elseif (t_0 <= 1e+306) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / Float64(sqrt(Float64(V / A)) / (l ^ -0.5))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 5e-317)
tmp = sqrt((A / V)) * (c0 / sqrt(l));
elseif (t_0 <= 1e+306)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / (sqrt((V / A)) / (l ^ -0.5));
end
tmp_2 = tmp;
end
NOTE: c0, A, 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, 5e-317], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 1e+306], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[(N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision] / N[Power[l, -0.5], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-317}:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;t_0 \leq 10^{+306}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\frac{\sqrt{\frac{V}{A}}}{{\ell}^{-0.5}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 5.00000017e-317Initial program 30.5%
*-un-lft-identity30.5%
times-frac56.2%
Applied egg-rr56.2%
*-commutative56.2%
frac-times30.5%
*-un-lft-identity30.5%
sqrt-div20.5%
associate-*l/20.6%
sqrt-prod18.7%
associate-/r*18.7%
*-commutative18.7%
associate-*r/18.7%
sqrt-div46.0%
Applied egg-rr46.0%
*-commutative46.0%
associate-*r/46.0%
Simplified46.0%
if 5.00000017e-317 < (/.f64 A (*.f64 V l)) < 1.00000000000000002e306Initial program 99.2%
if 1.00000000000000002e306 < (/.f64 A (*.f64 V l)) Initial program 43.3%
pow1/243.3%
associate-/r*54.5%
div-inv54.4%
unpow-prod-down40.3%
pow1/240.3%
Applied egg-rr40.3%
unpow1/240.3%
Simplified40.3%
clear-num40.3%
sqrt-div42.1%
metadata-eval42.1%
Applied egg-rr42.1%
associate-*l/42.1%
*-un-lft-identity42.1%
associate-*r/42.1%
inv-pow42.1%
sqrt-pow142.1%
metadata-eval42.1%
Applied egg-rr42.1%
associate-/l*42.1%
Simplified42.1%
Final simplification78.1%
NOTE: c0, A, 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 5e-317) (not (<= t_0 2e+304)))
(* (sqrt (/ A V)) (/ c0 (sqrt l)))
(* c0 (sqrt t_0)))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if ((t_0 <= 5e-317) || !(t_0 <= 2e+304)) {
tmp = sqrt((A / V)) * (c0 / sqrt(l));
} else {
tmp = c0 * sqrt(t_0);
}
return tmp;
}
NOTE: c0, A, 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 <= 5d-317) .or. (.not. (t_0 <= 2d+304))) then
tmp = sqrt((a / v)) * (c0 / sqrt(l))
else
tmp = c0 * sqrt(t_0)
end if
code = tmp
end function
assert c0 < A && A < V && 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 <= 5e-317) || !(t_0 <= 2e+304)) {
tmp = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
} else {
tmp = c0 * Math.sqrt(t_0);
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if (t_0 <= 5e-317) or not (t_0 <= 2e+304): tmp = math.sqrt((A / V)) * (c0 / math.sqrt(l)) else: tmp = c0 * math.sqrt(t_0) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if ((t_0 <= 5e-317) || !(t_0 <= 2e+304)) tmp = Float64(sqrt(Float64(A / V)) * Float64(c0 / sqrt(l))); else tmp = Float64(c0 * sqrt(t_0)); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if ((t_0 <= 5e-317) || ~((t_0 <= 2e+304)))
tmp = sqrt((A / V)) * (c0 / sqrt(l));
else
tmp = c0 * sqrt(t_0);
end
tmp_2 = tmp;
end
NOTE: c0, A, 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, 5e-317], N[Not[LessEqual[t$95$0, 2e+304]], $MachinePrecision]], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-317} \lor \neg \left(t_0 \leq 2 \cdot 10^{+304}\right):\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 5.00000017e-317 or 1.9999999999999999e304 < (/.f64 A (*.f64 V l)) Initial program 37.6%
*-un-lft-identity37.6%
times-frac55.8%
Applied egg-rr55.8%
*-commutative55.8%
frac-times37.6%
*-un-lft-identity37.6%
sqrt-div25.4%
associate-*l/25.4%
sqrt-prod21.2%
associate-/r*21.2%
*-commutative21.2%
associate-*r/21.1%
sqrt-div42.7%
Applied egg-rr42.7%
*-commutative42.7%
associate-*r/42.6%
Simplified42.6%
if 5.00000017e-317 < (/.f64 A (*.f64 V l)) < 1.9999999999999999e304Initial program 99.2%
Final simplification77.3%
NOTE: c0, A, 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))) (t_1 (sqrt (/ A V))))
(if (<= t_0 5e-317)
(* t_1 (/ c0 (sqrt l)))
(if (<= t_0 2e+304) (* c0 (sqrt t_0)) (* c0 (/ t_1 (sqrt l)))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double t_1 = sqrt((A / V));
double tmp;
if (t_0 <= 5e-317) {
tmp = t_1 * (c0 / sqrt(l));
} else if (t_0 <= 2e+304) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 * (t_1 / sqrt(l));
}
return tmp;
}
NOTE: c0, A, 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) :: t_1
real(8) :: tmp
t_0 = a / (v * l)
t_1 = sqrt((a / v))
if (t_0 <= 5d-317) then
tmp = t_1 * (c0 / sqrt(l))
else if (t_0 <= 2d+304) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 * (t_1 / sqrt(l))
end if
code = tmp
end function
assert c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double t_1 = Math.sqrt((A / V));
double tmp;
if (t_0 <= 5e-317) {
tmp = t_1 * (c0 / Math.sqrt(l));
} else if (t_0 <= 2e+304) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 * (t_1 / Math.sqrt(l));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = A / (V * l) t_1 = math.sqrt((A / V)) tmp = 0 if t_0 <= 5e-317: tmp = t_1 * (c0 / math.sqrt(l)) elif t_0 <= 2e+304: tmp = c0 * math.sqrt(t_0) else: tmp = c0 * (t_1 / math.sqrt(l)) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) t_1 = sqrt(Float64(A / V)) tmp = 0.0 if (t_0 <= 5e-317) tmp = Float64(t_1 * Float64(c0 / sqrt(l))); elseif (t_0 <= 2e+304) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 * Float64(t_1 / sqrt(l))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
t_1 = sqrt((A / V));
tmp = 0.0;
if (t_0 <= 5e-317)
tmp = t_1 * (c0 / sqrt(l));
elseif (t_0 <= 2e+304)
tmp = c0 * sqrt(t_0);
else
tmp = c0 * (t_1 / sqrt(l));
end
tmp_2 = tmp;
end
NOTE: c0, A, 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]}, Block[{t$95$1 = N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[t$95$0, 5e-317], N[(t$95$1 * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 * N[(t$95$1 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
t_1 := \sqrt{\frac{A}{V}}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-317}:\\
\;\;\;\;t_1 \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;c0 \cdot \frac{t_1}{\sqrt{\ell}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 5.00000017e-317Initial program 30.5%
*-un-lft-identity30.5%
times-frac56.2%
Applied egg-rr56.2%
*-commutative56.2%
frac-times30.5%
*-un-lft-identity30.5%
sqrt-div20.5%
associate-*l/20.6%
sqrt-prod18.7%
associate-/r*18.7%
*-commutative18.7%
associate-*r/18.7%
sqrt-div46.0%
Applied egg-rr46.0%
*-commutative46.0%
associate-*r/46.0%
Simplified46.0%
if 5.00000017e-317 < (/.f64 A (*.f64 V l)) < 1.9999999999999999e304Initial program 99.2%
if 1.9999999999999999e304 < (/.f64 A (*.f64 V l)) Initial program 44.4%
associate-/r*53.5%
sqrt-div39.5%
associate-*r/39.5%
Applied egg-rr39.5%
*-commutative39.5%
associate-/l*39.5%
associate-/r/39.5%
Simplified39.5%
Final simplification77.3%
NOTE: c0, A, 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 5e-317)
(* (sqrt (/ A V)) (/ c0 (sqrt l)))
(if (<= t_0 2e+304)
(* c0 (sqrt t_0))
(/ c0 (* (sqrt l) (sqrt (/ V A))))))))assert(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
double t_0 = A / (V * l);
double tmp;
if (t_0 <= 5e-317) {
tmp = sqrt((A / V)) * (c0 / sqrt(l));
} else if (t_0 <= 2e+304) {
tmp = c0 * sqrt(t_0);
} else {
tmp = c0 / (sqrt(l) * sqrt((V / A)));
}
return tmp;
}
NOTE: c0, A, 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 <= 5d-317) then
tmp = sqrt((a / v)) * (c0 / sqrt(l))
else if (t_0 <= 2d+304) then
tmp = c0 * sqrt(t_0)
else
tmp = c0 / (sqrt(l) * sqrt((v / a)))
end if
code = tmp
end function
assert c0 < A && A < V && 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 <= 5e-317) {
tmp = Math.sqrt((A / V)) * (c0 / Math.sqrt(l));
} else if (t_0 <= 2e+304) {
tmp = c0 * Math.sqrt(t_0);
} else {
tmp = c0 / (Math.sqrt(l) * Math.sqrt((V / A)));
}
return tmp;
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): t_0 = A / (V * l) tmp = 0 if t_0 <= 5e-317: tmp = math.sqrt((A / V)) * (c0 / math.sqrt(l)) elif t_0 <= 2e+304: tmp = c0 * math.sqrt(t_0) else: tmp = c0 / (math.sqrt(l) * math.sqrt((V / A))) return tmp
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) t_0 = Float64(A / Float64(V * l)) tmp = 0.0 if (t_0 <= 5e-317) tmp = Float64(sqrt(Float64(A / V)) * Float64(c0 / sqrt(l))); elseif (t_0 <= 2e+304) tmp = Float64(c0 * sqrt(t_0)); else tmp = Float64(c0 / Float64(sqrt(l) * sqrt(Float64(V / A)))); end return tmp end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp_2 = code(c0, A, V, l)
t_0 = A / (V * l);
tmp = 0.0;
if (t_0 <= 5e-317)
tmp = sqrt((A / V)) * (c0 / sqrt(l));
elseif (t_0 <= 2e+304)
tmp = c0 * sqrt(t_0);
else
tmp = c0 / (sqrt(l) * sqrt((V / A)));
end
tmp_2 = tmp;
end
NOTE: c0, A, 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, 5e-317], N[(N[Sqrt[N[(A / V), $MachinePrecision]], $MachinePrecision] * N[(c0 / N[Sqrt[l], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[t$95$0, 2e+304], N[(c0 * N[Sqrt[t$95$0], $MachinePrecision]), $MachinePrecision], N[(c0 / N[(N[Sqrt[l], $MachinePrecision] * N[Sqrt[N[(V / A), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
\begin{array}{l}
t_0 := \frac{A}{V \cdot \ell}\\
\mathbf{if}\;t_0 \leq 5 \cdot 10^{-317}:\\
\;\;\;\;\sqrt{\frac{A}{V}} \cdot \frac{c0}{\sqrt{\ell}}\\
\mathbf{elif}\;t_0 \leq 2 \cdot 10^{+304}:\\
\;\;\;\;c0 \cdot \sqrt{t_0}\\
\mathbf{else}:\\
\;\;\;\;\frac{c0}{\sqrt{\ell} \cdot \sqrt{\frac{V}{A}}}\\
\end{array}
\end{array}
if (/.f64 A (*.f64 V l)) < 5.00000017e-317Initial program 30.5%
*-un-lft-identity30.5%
times-frac56.2%
Applied egg-rr56.2%
*-commutative56.2%
frac-times30.5%
*-un-lft-identity30.5%
sqrt-div20.5%
associate-*l/20.6%
sqrt-prod18.7%
associate-/r*18.7%
*-commutative18.7%
associate-*r/18.7%
sqrt-div46.0%
Applied egg-rr46.0%
*-commutative46.0%
associate-*r/46.0%
Simplified46.0%
if 5.00000017e-317 < (/.f64 A (*.f64 V l)) < 1.9999999999999999e304Initial program 99.2%
if 1.9999999999999999e304 < (/.f64 A (*.f64 V l)) Initial program 44.4%
*-un-lft-identity44.4%
times-frac55.3%
Applied egg-rr55.3%
frac-times44.4%
*-un-lft-identity44.4%
*-un-lft-identity44.4%
*-commutative44.4%
times-frac53.4%
sqrt-unprod39.5%
*-commutative39.5%
expm1-log1p-u13.4%
expm1-udef9.6%
Applied egg-rr20.8%
expm1-def22.6%
expm1-log1p54.4%
Simplified54.4%
*-commutative54.4%
sqrt-prod41.2%
Applied egg-rr41.2%
Final simplification77.7%
NOTE: c0, A, 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(c0 < A && A < V && V < l);
double code(double c0, double A, double V, double l) {
return c0 * sqrt((A / (V * l)));
}
NOTE: c0, A, 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 c0 < A && A < V && V < l;
public static double code(double c0, double A, double V, double l) {
return c0 * Math.sqrt((A / (V * l)));
}
[c0, A, V, l] = sort([c0, A, V, l]) def code(c0, A, V, l): return c0 * math.sqrt((A / (V * l)))
c0, A, V, l = sort([c0, A, V, l]) function code(c0, A, V, l) return Float64(c0 * sqrt(Float64(A / Float64(V * l)))) end
c0, A, V, l = num2cell(sort([c0, A, V, l])){:}
function tmp = code(c0, A, V, l)
tmp = c0 * sqrt((A / (V * l)));
end
NOTE: c0, A, 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}
[c0, A, V, l] = \mathsf{sort}([c0, A, V, l])\\
\\
c0 \cdot \sqrt{\frac{A}{V \cdot \ell}}
\end{array}
Initial program 75.4%
Final simplification75.4%
herbie shell --seed 2024024
(FPCore (c0 A V l)
:name "Henrywood and Agarwal, Equation (3)"
:precision binary64
(* c0 (sqrt (/ A (* V l)))))