\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 0.6600767947515078:\\
\;\;\;\;\cos \left(\frac{\sqrt[3]{K \cdot \left(m + n\right)} \cdot \left(\sqrt[3]{K \cdot \left(m + n\right)} \cdot \sqrt[3]{K \cdot \left(m + n\right)}\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(\left|m - n\right| + \left(m + n\right) \cdot M\right) - \left(\left(M \cdot M + \left(\ell + 0.5 \cdot \left(m \cdot n\right)\right)\right) + 0.25 \cdot \left(n \cdot n + m \cdot m\right)\right)} + 0.5 \cdot \left(K \cdot \left(\sin M \cdot \left(m \cdot e^{\left(\left|m - n\right| + \left(m + n\right) \cdot M\right) - \left(\left(M \cdot M + \left(\ell + 0.5 \cdot \left(m \cdot n\right)\right)\right) + 0.25 \cdot \left(n \cdot n + m \cdot m\right)\right)}\right)\right) + e^{\left(\left|m - n\right| + \left(m + n\right) \cdot M\right) - \left(\left(M \cdot M + \left(\ell + 0.5 \cdot \left(m \cdot n\right)\right)\right) + 0.25 \cdot \left(n \cdot n + m \cdot m\right)\right)} \cdot \left(\sin M \cdot \left(K \cdot n\right)\right)\right)\\
\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))))
0.6600767947515078)
(*
(cos
(-
(/
(* (cbrt (* K (+ m n))) (* (cbrt (* K (+ m n))) (cbrt (* K (+ m n)))))
2.0)
M))
(exp (- (fabs (- m n)) (+ (pow (- (/ (+ m n) 2.0) M) 2.0) l))))
(+
(*
(cos M)
(exp
(-
(+ (fabs (- m n)) (* (+ m n) M))
(+ (+ (* M M) (+ l (* 0.5 (* m n)))) (* 0.25 (+ (* n n) (* m m)))))))
(*
0.5
(+
(*
K
(*
(sin M)
(*
m
(exp
(-
(+ (fabs (- m n)) (* (+ m n) M))
(+
(+ (* M M) (+ l (* 0.5 (* m n))))
(* 0.25 (+ (* n n) (* m m)))))))))
(*
(exp
(-
(+ (fabs (- m n)) (* (+ m n) M))
(+ (+ (* M M) (+ l (* 0.5 (* m n)))) (* 0.25 (+ (* n n) (* m m))))))
(* (sin M) (* K n))))))))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))) <= 0.6600767947515078) {
tmp = cos(((cbrt(K * (m + n)) * (cbrt(K * (m + n)) * cbrt(K * (m + n)))) / 2.0) - M) * exp(fabs(m - n) - (pow((((m + n) / 2.0) - M), 2.0) + l));
} else {
tmp = (cos(M) * exp((fabs(m - n) + ((m + n) * M)) - (((M * M) + (l + (0.5 * (m * n)))) + (0.25 * ((n * n) + (m * m)))))) + (0.5 * ((K * (sin(M) * (m * exp((fabs(m - n) + ((m + n) * M)) - (((M * M) + (l + (0.5 * (m * n)))) + (0.25 * ((n * n) + (m * m)))))))) + (exp((fabs(m - n) + ((m + n) * M)) - (((M * M) + (l + (0.5 * (m * n)))) + (0.25 * ((n * n) + (m * m))))) * (sin(M) * (K * n)))));
}
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)))))) < 0.66007679475150782Initial program 1.1
Simplified1.1
rmApplied add-cube-cbrt_binary64_7951.1
if 0.66007679475150782 < (*.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 53.2
Simplified53.2
Taylor expanded around 0 52.1
Simplified52.1
Taylor expanded around 0 29.7
Simplified37.7
Final simplification11.1
herbie shell --seed 2020339
(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)))))))