Average Error: 15.3 → 1.2
Time: 12.4s
Precision: binary64
Cost: 26624
\[\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)}\]
\[e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos M\]
\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)}
e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos M
(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
 (* (exp (- (fabs (- m n)) (+ (pow (- (/ (+ m n) 2.0) M) 2.0) l))) (cos M)))
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) {
	return exp(fabs(m - n) - (pow((((m + n) / 2.0) - M), 2.0) + l)) * cos(M);
}

Error

Bits error versus K

Bits error versus m

Bits error versus n

Bits error versus M

Bits error versus l

Try it out

Your Program's Arguments

Results

Enter valid numbers for all inputs

Alternatives

Alternative 1
Error15.3
Cost73280
\[\left(\left(\sqrt[3]{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)} \cdot \sqrt[3]{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}\right) \cdot \sqrt[3]{\sqrt[3]{{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}^{3}}}\right) \cdot e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}\]
Alternative 2
Error15.3
Cost60416
\[e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \left(\sqrt[3]{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)} \cdot \left(\sqrt[3]{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)} \cdot \sqrt[3]{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}\right)\right)\]
Alternative 3
Error15.3
Cost47360
\[e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos \left(\sqrt[3]{\frac{K \cdot \left(m + n\right)}{2}} \cdot \left(\sqrt[3]{\frac{K \cdot \left(m + n\right)}{2}} \cdot \sqrt[3]{\frac{K \cdot \left(m + n\right)}{2}}\right) - M\right)\]
Alternative 4
Error33.5
Cost40000
\[e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos \left(\sqrt[3]{{\left(\frac{K \cdot \left(m + n\right)}{2}\right)}^{3}} - M\right)\]
Alternative 5
Error15.3
Cost40000
\[\sqrt[3]{{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}^{3}} \cdot e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}\]
Alternative 6
Error39.1
Cost39936
\[e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos \left(e^{\log \left(\frac{K \cdot \left(m + n\right)}{2}\right)} - M\right)\]
Alternative 7
Error15.3
Cost39936
\[e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \log \left(e^{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}\right)\]
Alternative 8
Error39.1
Cost39936
\[e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos \left(\frac{e^{\log \left(K \cdot \left(m + n\right)\right)}}{2} - M\right)\]
Alternative 9
Error36.2
Cost27648
\[e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos \left(\frac{K \cdot \left(m \cdot m - n \cdot n\right)}{2 \cdot \left(m - n\right)} - M\right)\]
Alternative 10
Error15.3
Cost27136
\[\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}}\]
Alternative 11
Error15.3
Cost27136
\[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}\]
Alternative 12
Error15.3
Cost21184
\[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left(\ell + \left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right)\right)}\]
Alternative 13
Error36.9
Cost21056
\[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left(\ell + \left(0.25 \cdot \left(m \cdot m\right) + m \cdot \left(n \cdot 0.5 - M\right)\right)\right)}\]
Alternative 14
Error34.9
Cost20928
\[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left(\ell + n \cdot \left(n \cdot 0.25 + \left(m \cdot 0.5 - M\right)\right)\right)}\]
Alternative 15
Error1.2
Cost20672
\[\cos M \cdot e^{\left|m - n\right| - \left(\ell + \left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right)\right)}\]
Alternative 16
Error35.1
Cost20544
\[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left(\ell + 0.25 \cdot \left(m \cdot m\right)\right)}\]
Alternative 17
Error34.5
Cost20544
\[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left(\ell + 0.25 \cdot \left(n \cdot n\right)\right)}\]
Alternative 18
Error30.2
Cost20544
\[\cos M \cdot e^{\left|m - n\right| - \left(\ell + \left(0.25 \cdot \left(m \cdot m\right) + m \cdot \left(n \cdot 0.5 - M\right)\right)\right)}\]
Alternative 19
Error34.3
Cost20416
\[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left(\ell + M \cdot M\right)}\]
Alternative 20
Error25.7
Cost20032
\[\cos M \cdot e^{\left|m - n\right| - \left(\ell + 0.25 \cdot \left(n \cdot n\right)\right)}\]
Alternative 21
Error26.6
Cost20032
\[\cos M \cdot e^{\left|m - n\right| - \left(\ell + 0.25 \cdot \left(m \cdot m\right)\right)}\]
Alternative 22
Error28.9
Cost19904
\[e^{\left|m - n\right| - \left(\ell + M \cdot M\right)} \cdot \cos M\]
Alternative 23
Error34.1
Cost19776
\[\cos M \cdot e^{\left|m - n\right| - M \cdot M}\]
Alternative 24
Error51.1
Cost19648
\[\cos M \cdot e^{\left|m - n\right| - \ell}\]
Alternative 25
Error30.1
Cost13760
\[\cos M \cdot e^{n \cdot M - n \cdot \left(n \cdot 0.25 + m \cdot 0.5\right)}\]
Alternative 26
Error30.2
Cost13760
\[\cos M \cdot e^{m \cdot M - m \cdot \left(n \cdot 0.5 + m \cdot 0.25\right)}\]
Alternative 27
Error27.2
Cost13248
\[\cos M \cdot e^{\left(n \cdot n\right) \cdot -0.25}\]
Alternative 28
Error27.7
Cost13248
\[\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\]
Alternative 29
Error26.9
Cost13184
\[\cos M \cdot e^{M \cdot \left(-M\right)}\]
Alternative 30
Error43.4
Cost13056
\[\cos M \cdot e^{-\ell}\]
Alternative 31
Error59.3
Cost64
\[1\]
Alternative 32
Error4.1
Cost64
\[0\]
Alternative 33
Error61.9
Cost64
\[-1\]

Error

Derivation

  1. Initial program 15.3

    \[\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)}\]
  2. Simplified15.3

    \[\leadsto \color{blue}{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}}\]
  3. Taylor expanded around 0 1.2

    \[\leadsto \color{blue}{\cos \left(-M\right)} \cdot e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}\]
  4. Simplified1.2

    \[\leadsto \color{blue}{\cos M} \cdot e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}\]
  5. Simplified1.2

    \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos M}\]
  6. Final simplification1.2

    \[\leadsto e^{\left|m - n\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)} \cdot \cos M\]

Reproduce

herbie shell --seed 2021042 
(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)))))))