\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}
\mathbf{if}\;J \leq -1.6296351963608448 \cdot 10^{-276} \lor \neg \left(J \leq 4.561103969082136 \cdot 10^{-100}\right):\\
\;\;\;\;\begin{array}{l}
t_0 := \cos \left(\frac{K}{2}\right)\\
\left(\left(J \cdot -2\right) \cdot t_0\right) \cdot \mathsf{hypot}\left(1, \frac{U}{t_0 \cdot \left(J \cdot 2\right)}\right)
\end{array}\\
\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
(if (or (<= J -1.6296351963608448e-276) (not (<= J 4.561103969082136e-100)))
(let* ((t_0 (cos (/ K 2.0))))
(* (* (* J -2.0) 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 tmp;
if ((J <= -1.6296351963608448e-276) || !(J <= 4.561103969082136e-100)) {
double t_0_1 = cos(K / 2.0);
tmp = ((J * -2.0) * t_0_1) * hypot(1.0, (U / (t_0_1 * (J * 2.0))));
} else {
tmp = U;
}
return tmp;
}



Bits error versus J



Bits error versus K



Bits error versus U
Results
if J < -1.6296351963608448e-276 or 4.56110396908213611e-100 < J Initial program 13.5
Simplified5.0
if -1.6296351963608448e-276 < J < 4.56110396908213611e-100Initial program 39.9
Simplified23.5
Taylor expanded in U around -inf 36.0
Final simplification11.0
herbie shell --seed 2021339
(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)))))