\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}\begin{array}{l}
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}} \leq \mathsf{NaN}:\\
\;\;\;\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;0\\
\end{array}(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
(FPCore (K m n M l)
:precision binary64
(if (<=
(*
(cos (- (/ (* K (+ m n)) 2.0) M))
(exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0))))
NAN)
(*
(cos (- (/ (* K (+ m n)) 2.0) M))
(exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0))))
0.0))double code(double K, double m, double n, double M, double l) {
return cos(((K * (m + n)) / 2.0) - M) * exp(-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs(m - n)));
}
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((cos(((K * (m + n)) / 2.0) - M) * exp((fabs(m - n) - l) - pow((((m + n) / 2.0) - M), 2.0))) <= ((double) NAN)) {
tmp = cos(((K * (m + n)) / 2.0) - M) * exp((fabs(m - n) - l) - pow((((m + n) / 2.0) - M), 2.0));
} else {
tmp = 0.0;
}
return tmp;
}



Bits error versus K



Bits error versus m



Bits error versus n



Bits error versus M



Bits error versus l
Results
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) 2) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) 2) M) 2)) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 15.5
if +nan.0 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) 2) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) 2) M) 2)) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 4.3
Final simplification4.3
herbie shell --seed 2021113
(FPCore (K m n M l)
:name "Maksimov and Kolovsky, Equation (32)"
:precision binary64
(* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))