\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(-2 \cdot J\right) \cdot t_0\\
\mathbf{if}\;U \leq 1.1056860198100382 \cdot 10^{+220}:\\
\;\;\;\;t_1 \cdot \mathsf{hypot}\left(1, \frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)\\
\mathbf{elif}\;U \leq 3.069282919857268 \cdot 10^{+290}:\\
\;\;\;\;U\\
\mathbf{else}:\\
\;\;\;\;t_1 \cdot \mathsf{hypot}\left(1, \frac{\frac{U}{t_0}}{J \cdot 2}\right)\\
\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)))
(if (<= U 1.1056860198100382e+220)
(* t_1 (hypot 1.0 (/ U (* t_0 (* J 2.0)))))
(if (<= U 3.069282919857268e+290)
U
(* t_1 (hypot 1.0 (/ (/ U t_0) (* J 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 / 2.0);
double t_1 = (-2.0 * J) * t_0;
double tmp;
if (U <= 1.1056860198100382e+220) {
tmp = t_1 * hypot(1.0, (U / (t_0 * (J * 2.0))));
} else if (U <= 3.069282919857268e+290) {
tmp = U;
} else {
tmp = t_1 * hypot(1.0, ((U / t_0) / (J * 2.0)));
}
return tmp;
}



Bits error versus J



Bits error versus K



Bits error versus U
Results
if U < 1.1056860198100382e220Initial program 16.5
Simplified6.6
if 1.1056860198100382e220 < U < 3.0692829198572679e290Initial program 43.1
Simplified27.7
Taylor expanded in U around -inf 31.9
if 3.0692829198572679e290 < U Initial program 48.6
Simplified27.4
Applied associate-/r*_binary6427.4
Final simplification8.2
herbie shell --seed 2021215
(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)))))