(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 0.5))))
(if (<= U 2.15e+232)
(* -2.0 (* (* J t_0) (hypot 1.0 (/ U (* t_0 (* J 2.0))))))
(* -2.0 (fma 0.5 U (* (/ J (/ U J)) (pow t_0 2.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 * 0.5));
double tmp;
if (U <= 2.15e+232) {
tmp = -2.0 * ((J * t_0) * hypot(1.0, (U / (t_0 * (J * 2.0)))));
} else {
tmp = -2.0 * fma(0.5, U, ((J / (U / J)) * pow(t_0, 2.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 * 0.5)) tmp = 0.0 if (U <= 2.15e+232) tmp = Float64(-2.0 * Float64(Float64(J * t_0) * hypot(1.0, Float64(U / Float64(t_0 * Float64(J * 2.0)))))); else tmp = Float64(-2.0 * fma(0.5, U, Float64(Float64(J / Float64(U / J)) * (t_0 ^ 2.0)))); end return 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 * 0.5), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[U, 2.15e+232], N[(-2.0 * N[(N[(J * t$95$0), $MachinePrecision] * N[Sqrt[1.0 ^ 2 + N[(U / N[(t$95$0 * N[(J * 2.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] ^ 2], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(-2.0 * N[(0.5 * U + N[(N[(J / N[(U / J), $MachinePrecision]), $MachinePrecision] * N[Power[t$95$0, 2.0], $MachinePrecision]), $MachinePrecision]), $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}
t_0 := \cos \left(K \cdot 0.5\right)\\
\mathbf{if}\;U \leq 2.15 \cdot 10^{+232}:\\
\;\;\;\;-2 \cdot \left(\left(J \cdot t_0\right) \cdot \mathsf{hypot}\left(1, \frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;-2 \cdot \mathsf{fma}\left(0.5, U, \frac{J}{\frac{U}{J}} \cdot {t_0}^{2}\right)\\
\end{array}



Bits error versus J



Bits error versus K



Bits error versus U
if U < 2.1500000000000001e232Initial program 16.1
Simplified6.5
Applied egg-rr7.6
Applied egg-rr6.5
if 2.1500000000000001e232 < U Initial program 44.4
Simplified29.6
Applied egg-rr30.2
Applied egg-rr29.6
Taylor expanded in J around 0 37.9
Simplified32.7
Final simplification8.2
herbie shell --seed 2022160
(FPCore (J K U)
:name "Maksimov and Kolovsky, Equation (3)"
:precision binary64
(* (* (* -2.0 J) (cos (/ K 2.0))) (sqrt (+ 1.0 (pow (/ U (* (* 2.0 J) (cos (/ K 2.0)))) 2.0)))))