\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.6525644811133454 \cdot 10^{-209} \lor \neg \left(J \leq 5.019231347031117 \cdot 10^{-278}\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.6525644811133454e-209) (not (<= J 5.019231347031117e-278)))
(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.6525644811133454e-209) || !(J <= 5.019231347031117e-278)) {
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.65256448111334541e-209 or 5.01923134703111726e-278 < J Initial program 14.9
Simplified5.7
Applied pow1_binary645.7
Applied pow1_binary645.7
Applied pow1_binary645.7
Applied pow1_binary645.7
Applied pow-prod-down_binary645.7
Applied pow-prod-down_binary645.7
Applied pow-prod-down_binary645.7
if -1.65256448111334541e-209 < J < 5.01923134703111726e-278Initial program 42.2
Simplified26.4
Taylor expanded in J around 0 32.4
Simplified32.4
Final simplification8.6
herbie shell --seed 2021280
(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)))))