\[\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}
\]
↓
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;U\\
\mathbf{elif}\;t_1 \leq 10^{+297}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
(FPCore (J K U)
:precision binary64
(*
(* (* -2.0 J) (cos (/ K 2.0)))
(sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) (cos (/ K 2.0)))) 2.0)))))
↓
(FPCore (J K U)
:precision binary64
(let* ((t_0 (cos (/ K 2.0)))
(t_1
(*
(* (* -2.0 J) t_0)
(sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) t_0)) 2.0))))))
(if (<= t_1 (- INFINITY)) U (if (<= t_1 1e+297) t_1 U))))double code(double J, double K, double U) {
return ((-2.0 * J) * cos((K / 2.0))) * sqrt((1.0 + pow((U / ((2.0 * J) * cos((K / 2.0)))), 2.0)));
}
↓
double code(double J, double K, double U) {
double t_0 = cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + pow((U / ((2.0 * J) * t_0)), 2.0)));
double tmp;
if (t_1 <= -((double) INFINITY)) {
tmp = U;
} else if (t_1 <= 1e+297) {
tmp = t_1;
} else {
tmp = U;
}
return tmp;
}
public static double code(double J, double K, double U) {
return ((-2.0 * J) * Math.cos((K / 2.0))) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * Math.cos((K / 2.0)))), 2.0)));
}
↓
public static double code(double J, double K, double U) {
double t_0 = Math.cos((K / 2.0));
double t_1 = ((-2.0 * J) * t_0) * Math.sqrt((1.0 + Math.pow((U / ((2.0 * J) * t_0)), 2.0)));
double tmp;
if (t_1 <= -Double.POSITIVE_INFINITY) {
tmp = U;
} else if (t_1 <= 1e+297) {
tmp = t_1;
} else {
tmp = U;
}
return tmp;
}
def code(J, K, U):
return ((-2.0 * J) * math.cos((K / 2.0))) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * math.cos((K / 2.0)))), 2.0)))
↓
def code(J, K, U):
t_0 = math.cos((K / 2.0))
t_1 = ((-2.0 * J) * t_0) * math.sqrt((1.0 + math.pow((U / ((2.0 * J) * t_0)), 2.0)))
tmp = 0
if t_1 <= -math.inf:
tmp = U
elif t_1 <= 1e+297:
tmp = t_1
else:
tmp = U
return tmp
function code(J, K, U)
return Float64(Float64(Float64(-2.0 * J) * cos(Float64(K / 2.0))) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * cos(Float64(K / 2.0)))) ^ 2.0))))
end
↓
function code(J, K, U)
t_0 = cos(Float64(K / 2.0))
t_1 = Float64(Float64(Float64(-2.0 * J) * t_0) * sqrt(Float64(1.0 + (Float64(U / Float64(Float64(2.0 * J) * t_0)) ^ 2.0))))
tmp = 0.0
if (t_1 <= Float64(-Inf))
tmp = U;
elseif (t_1 <= 1e+297)
tmp = t_1;
else
tmp = U;
end
return tmp
end
function tmp = code(J, K, U)
tmp = ((-2.0 * J) * cos((K / 2.0))) * sqrt((1.0 + ((U / ((2.0 * J) * cos((K / 2.0)))) ^ 2.0)));
end
↓
function tmp_2 = code(J, K, U)
t_0 = cos((K / 2.0));
t_1 = ((-2.0 * J) * t_0) * sqrt((1.0 + ((U / ((2.0 * J) * t_0)) ^ 2.0)));
tmp = 0.0;
if (t_1 <= -Inf)
tmp = U;
elseif (t_1 <= 1e+297)
tmp = t_1;
else
tmp = U;
end
tmp_2 = tmp;
end
code[J_, K_, U_] := N[(N[(N[(-2.0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
↓
code[J_, K_, U_] := Block[{t$95$0 = N[Cos[N[(K / 2.0), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(N[(-2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision] * N[Sqrt[N[(1.0 + N[Power[N[(U / N[(N[(2.0 * J), $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[t$95$1, (-Infinity)], U, If[LessEqual[t$95$1, 1e+297], t$95$1, U]]]]
\left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)}\right)}^{2}}
↓
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
t_1 := \left(\left(-2 \cdot J\right) \cdot t_0\right) \cdot \sqrt{1 + {\left(\frac{U}{\left(2 \cdot J\right) \cdot t_0}\right)}^{2}}\\
\mathbf{if}\;t_1 \leq -\infty:\\
\;\;\;\;U\\
\mathbf{elif}\;t_1 \leq 10^{+297}:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
Alternatives
| Alternative 1 |
|---|
| Error | 16.4 |
|---|
| Cost | 27408 |
|---|
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq -8.2 \cdot 10^{+273}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -6.4 \cdot 10^{+211}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -1.9 \cdot 10^{+185}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 4.4 \cdot 10^{+150}:\\
\;\;\;\;t_0 \cdot \left(\left(-2 \cdot J\right) \cdot \sqrt{1 + {\left(\frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)}^{2}}\right)\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
| Alternative 2 |
|---|
| Error | 21.3 |
|---|
| Cost | 21016 |
|---|
\[\begin{array}{l}
t_0 := \left(\left(-2 \cdot J\right) \cdot \cos \left(\frac{K}{2}\right)\right) \cdot \sqrt{1 + {\left(\frac{U}{2 \cdot J}\right)}^{2}}\\
\mathbf{if}\;U \leq -1.3 \cdot 10^{+269}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -7.2 \cdot 10^{+211}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -2.7 \cdot 10^{+185}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -7 \cdot 10^{+140}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq -1.55 \cdot 10^{+107}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 5.7 \cdot 10^{+94}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
| Alternative 3 |
|---|
| Error | 28.0 |
|---|
| Cost | 20692 |
|---|
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot -2\right)\\
\mathbf{if}\;U \leq -4 \cdot 10^{+278}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -1.66 \cdot 10^{+139}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -4.8 \cdot 10^{+18}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 3.8 \cdot 10^{-48}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq 7.2 \cdot 10^{+46}:\\
\;\;\;\;2 \cdot \frac{{\cos \left(0.5 \cdot K\right)}^{2} \cdot {J}^{2}}{U} + U\\
\mathbf{elif}\;U \leq 7 \cdot 10^{+93}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
| Alternative 4 |
|---|
| Error | 28.0 |
|---|
| Cost | 7640 |
|---|
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right) \cdot \left(J \cdot -2\right)\\
\mathbf{if}\;U \leq -4.4 \cdot 10^{+278}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -6.4 \cdot 10^{+135}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -5.2 \cdot 10^{+18}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 3.8 \cdot 10^{-48}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq 1.45 \cdot 10^{+47}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 3.6 \cdot 10^{+101}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq 5.3 \cdot 10^{+172}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
| Alternative 5 |
|---|
| Error | 38.0 |
|---|
| Cost | 720 |
|---|
\[\begin{array}{l}
\mathbf{if}\;U \leq -2.1 \cdot 10^{+274}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -3.7 \cdot 10^{+138}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -4.6 \cdot 10^{+18}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 2.15 \cdot 10^{-48}:\\
\;\;\;\;J \cdot -2\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
| Alternative 6 |
|---|
| Error | 46.5 |
|---|
| Cost | 656 |
|---|
\[\begin{array}{l}
\mathbf{if}\;U \leq -2 \cdot 10^{+271}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -7.8 \cdot 10^{+139}:\\
\;\;\;\;-U\\
\mathbf{elif}\;U \leq -1.15 \cdot 10^{-68}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq -9 \cdot 10^{-178}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
| Alternative 7 |
|---|
| Error | 46.6 |
|---|
| Cost | 64 |
|---|
\[U
\]