Math FPCore C Java Python Julia MATLAB Wolfram TeX \[\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}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq -2.4 \cdot 10^{+257}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \left(-2 \cdot t_0\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\\
\end{array}
\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))))
(if (<= U -2.4e+257)
U
(* (* J (* -2.0 t_0)) (hypot 1.0 (/ U (* J (* 2.0 t_0)))))))) 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 tmp;
if (U <= -2.4e+257) {
tmp = U;
} else {
tmp = (J * (-2.0 * t_0)) * hypot(1.0, (U / (J * (2.0 * t_0))));
}
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 tmp;
if (U <= -2.4e+257) {
tmp = U;
} else {
tmp = (J * (-2.0 * t_0)) * Math.hypot(1.0, (U / (J * (2.0 * t_0))));
}
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))
tmp = 0
if U <= -2.4e+257:
tmp = U
else:
tmp = (J * (-2.0 * t_0)) * math.hypot(1.0, (U / (J * (2.0 * t_0))))
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))
tmp = 0.0
if (U <= -2.4e+257)
tmp = U;
else
tmp = Float64(Float64(J * Float64(-2.0 * t_0)) * hypot(1.0, Float64(U / Float64(J * Float64(2.0 * t_0)))));
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));
tmp = 0.0;
if (U <= -2.4e+257)
tmp = U;
else
tmp = (J * (-2.0 * t_0)) * hypot(1.0, (U / (J * (2.0 * t_0))));
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]}, If[LessEqual[U, -2.4e+257], U, N[(N[(J * N[(-2.0 * t$95$0), $MachinePrecision]), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U / N[(J * N[(2.0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]]]
\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}
\\
\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq -2.4 \cdot 10^{+257}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \left(-2 \cdot t_0\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\\
\end{array}
\end{array}
Alternatives Alternative 1 Accuracy 87.4% Cost 20484
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq -2.4 \cdot 10^{+257}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;\left(J \cdot \left(-2 \cdot t_0\right)\right) \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\\
\end{array}
\]
Alternative 2 Accuracy 87.4% Cost 20484
\[\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\mathbf{if}\;U \leq -2.8 \cdot 10^{+257}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(t_0 \cdot \left(-2 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot \left(2 \cdot t_0\right)}\right)\right)\right)\\
\end{array}
\]
Alternative 3 Accuracy 73.2% Cost 13828
\[\begin{array}{l}
\mathbf{if}\;U \leq -1.8 \cdot 10^{+257}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(\cos \left(\frac{K}{2}\right) \cdot \left(-2 \cdot \mathsf{hypot}\left(1, \frac{U}{J \cdot 2}\right)\right)\right)\\
\end{array}
\]
Alternative 4 Accuracy 69.6% Cost 13700
\[\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K}{2}\right) \leq 0.9995:\\
\;\;\;\;J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{else}:\\
\;\;\;\;J \cdot \left(-2 \cdot \mathsf{hypot}\left(1, 0.5 \cdot \frac{U}{J}\right)\right)\\
\end{array}
\]
Alternative 5 Accuracy 58.1% Cost 7376
\[\begin{array}{l}
t_0 := J \cdot \left(-2 \cdot \cos \left(K \cdot 0.5\right)\right)\\
\mathbf{if}\;U \leq -5.5 \cdot 10^{+151}:\\
\;\;\;\;U\\
\mathbf{elif}\;U \leq 4.4 \cdot 10^{+42}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;U \leq 1.7 \cdot 10^{+106}:\\
\;\;\;\;-2 \cdot \frac{J}{\frac{U}{J}} - U\\
\mathbf{elif}\;U \leq 1.1 \cdot 10^{+149}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
Alternative 6 Accuracy 27.3% Cost 788
\[\begin{array}{l}
\mathbf{if}\;K \leq -3.6 \cdot 10^{-5}:\\
\;\;\;\;-U\\
\mathbf{elif}\;K \leq -5.5 \cdot 10^{-98}:\\
\;\;\;\;U\\
\mathbf{elif}\;K \leq -1.85 \cdot 10^{-151}:\\
\;\;\;\;-U\\
\mathbf{elif}\;K \leq 5.1 \cdot 10^{-284}:\\
\;\;\;\;U\\
\mathbf{elif}\;K \leq 3.75 \cdot 10^{-149}:\\
\;\;\;\;-U\\
\mathbf{else}:\\
\;\;\;\;U\\
\end{array}
\]
Alternative 7 Accuracy 40.6% Cost 588
\[\begin{array}{l}
\mathbf{if}\;J \leq -6.5 \cdot 10^{-18}:\\
\;\;\;\;J \cdot -2\\
\mathbf{elif}\;J \leq 1.1 \cdot 10^{-151}:\\
\;\;\;\;-U\\
\mathbf{elif}\;J \leq 0.024:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;J \cdot -2\\
\end{array}
\]
Alternative 8 Accuracy 26.6% Cost 64
\[U
\]