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



Bits error versus J



Bits error versus K



Bits error versus U
Results
if U < 3.6160212554621541e229Initial program 16.0
Simplified6.5
Applied add-sqr-sqrt_binary646.6
Applied associate-*r*_binary646.6
Applied associate-*l*_binary646.6
Simplified6.5
if 3.6160212554621541e229 < U Initial program 44.3
Simplified29.5
Taylor expanded in J around 0 32.9
Simplified32.9
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)))))