Maksimov and Kolovsky, Equation (32)

Percentage Accurate: 75.9% → 96.3%
Time: 7.3s
Alternatives: 9
Speedup: 2.6×

Specification

?
\[\begin{array}{l} \\ \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)} \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)))))))
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)))));
}
real(8) function code(k, m, n, m_1, l)
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8), intent (in) :: n
    real(8), intent (in) :: m_1
    real(8), intent (in) :: l
    code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
	return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l):
	return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l)
	return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n))))))
end
function tmp = code(K, m, n, M, l)
	tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n)))));
end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\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)}
\end{array}

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

The average percentage accuracy by input value. Horizontal axis shows value of an input variable; the variable is choosen in the title. Vertical axis is accuracy; higher is better. Red represent the original program, while blue represents Herbie's suggestion. These can be toggled with buttons below the plot. The line is an average while dots represent individual samples.

Accuracy vs Speed?

Herbie found 9 alternatives:

AlternativeAccuracySpeedup
The accuracy (vertical axis) and speed (horizontal axis) of each alternatives. Up and to the right is better. The red square shows the initial program, and each blue circle shows an alternative.The line shows the best available speed-accuracy tradeoffs.

Initial Program: 75.9% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \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)} \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)))))))
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)))));
}
real(8) function code(k, m, n, m_1, l)
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8), intent (in) :: n
    real(8), intent (in) :: m_1
    real(8), intent (in) :: l
    code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
	return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l):
	return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l)
	return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n))))))
end
function tmp = code(K, m, n, M, l)
	tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n)))));
end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\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)}
\end{array}

Alternative 1: 96.3% accurate, 1.6× speedup?

\[\begin{array}{l} \\ 1 \cdot e^{\left|n - m\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (* 1.0 (exp (- (fabs (- n m)) (+ (pow (fma 0.5 (+ n m) (- M)) 2.0) l)))))
double code(double K, double m, double n, double M, double l) {
	return 1.0 * exp((fabs((n - m)) - (pow(fma(0.5, (n + m), -M), 2.0) + l)));
}
function code(K, m, n, M, l)
	return Float64(1.0 * exp(Float64(abs(Float64(n - m)) - Float64((fma(0.5, Float64(n + m), Float64(-M)) ^ 2.0) + l))))
end
code[K_, m_, n_, M_, l_] := N[(1.0 * N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(N[Power[N[(0.5 * N[(n + m), $MachinePrecision] + (-M)), $MachinePrecision], 2.0], $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
1 \cdot e^{\left|n - m\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)}
\end{array}
Derivation
  1. Initial program 76.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. Add Preprocessing
  3. Taylor expanded in K around 0

    \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
  4. Step-by-step derivation
    1. *-commutativeN/A

      \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
    2. lower-*.f64N/A

      \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
  5. Applied rewrites97.5%

    \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
  6. Taylor expanded in M around 0

    \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
  7. Step-by-step derivation
    1. Applied rewrites97.8%

      \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
    2. Final simplification97.8%

      \[\leadsto 1 \cdot e^{\left|n - m\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \]
    3. Add Preprocessing

    Alternative 2: 86.7% accurate, 1.5× speedup?

    \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|n - m\right|\\ t_1 := e^{t\_0 - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)}\\ \mathbf{if}\;\ell \leq -8.8 \cdot 10^{+148}:\\ \;\;\;\;t\_1 \cdot 1\\ \mathbf{elif}\;\ell \leq 2.3 \cdot 10^{+68}:\\ \;\;\;\;e^{t\_0 - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\cos M \cdot t\_1\\ \end{array} \end{array} \]
    (FPCore (K m n M l)
     :precision binary64
     (let* ((t_0 (fabs (- n m))) (t_1 (exp (- t_0 (+ (* 0.25 (* n n)) l)))))
       (if (<= l -8.8e+148)
         (* t_1 1.0)
         (if (<= l 2.3e+68)
           (* (exp (- t_0 (pow (fma 0.5 (+ n m) (- M)) 2.0))) 1.0)
           (* (cos M) t_1)))))
    double code(double K, double m, double n, double M, double l) {
    	double t_0 = fabs((n - m));
    	double t_1 = exp((t_0 - ((0.25 * (n * n)) + l)));
    	double tmp;
    	if (l <= -8.8e+148) {
    		tmp = t_1 * 1.0;
    	} else if (l <= 2.3e+68) {
    		tmp = exp((t_0 - pow(fma(0.5, (n + m), -M), 2.0))) * 1.0;
    	} else {
    		tmp = cos(M) * t_1;
    	}
    	return tmp;
    }
    
    function code(K, m, n, M, l)
    	t_0 = abs(Float64(n - m))
    	t_1 = exp(Float64(t_0 - Float64(Float64(0.25 * Float64(n * n)) + l)))
    	tmp = 0.0
    	if (l <= -8.8e+148)
    		tmp = Float64(t_1 * 1.0);
    	elseif (l <= 2.3e+68)
    		tmp = Float64(exp(Float64(t_0 - (fma(0.5, Float64(n + m), Float64(-M)) ^ 2.0))) * 1.0);
    	else
    		tmp = Float64(cos(M) * t_1);
    	end
    	return tmp
    end
    
    code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(t$95$0 - N[(N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -8.8e+148], N[(t$95$1 * 1.0), $MachinePrecision], If[LessEqual[l, 2.3e+68], N[(N[Exp[N[(t$95$0 - N[Power[N[(0.5 * N[(n + m), $MachinePrecision] + (-M)), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * t$95$1), $MachinePrecision]]]]]
    
    \begin{array}{l}
    
    \\
    \begin{array}{l}
    t_0 := \left|n - m\right|\\
    t_1 := e^{t\_0 - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)}\\
    \mathbf{if}\;\ell \leq -8.8 \cdot 10^{+148}:\\
    \;\;\;\;t\_1 \cdot 1\\
    
    \mathbf{elif}\;\ell \leq 2.3 \cdot 10^{+68}:\\
    \;\;\;\;e^{t\_0 - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1\\
    
    \mathbf{else}:\\
    \;\;\;\;\cos M \cdot t\_1\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if l < -8.7999999999999995e148

      1. Initial program 69.7%

        \[\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. Add Preprocessing
      3. Taylor expanded in K around 0

        \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
      4. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
        2. lower-*.f64N/A

          \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
      5. Applied rewrites93.9%

        \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
      6. Taylor expanded in M around 0

        \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
      7. Step-by-step derivation
        1. Applied rewrites97.0%

          \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
        2. Taylor expanded in n around inf

          \[\leadsto e^{\left|m - n\right| - \left(\frac{1}{4} \cdot {n}^{2} + \ell\right)} \cdot 1 \]
        3. Step-by-step derivation
          1. Applied rewrites76.1%

            \[\leadsto e^{\left|m - n\right| - \left(\left(n \cdot n\right) \cdot 0.25 + \ell\right)} \cdot 1 \]

          if -8.7999999999999995e148 < l < 2.3e68

          1. Initial program 73.8%

            \[\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. Add Preprocessing
          3. Taylor expanded in K around 0

            \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
          4. Step-by-step derivation
            1. *-commutativeN/A

              \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
            2. lower-*.f64N/A

              \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
          5. Applied rewrites97.5%

            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
          6. Taylor expanded in M around 0

            \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
          7. Step-by-step derivation
            1. Applied rewrites97.5%

              \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
            2. Taylor expanded in l around 0

              \[\leadsto e^{\left|m - n\right| - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}} \cdot 1 \]
            3. Step-by-step derivation
              1. Applied rewrites95.4%

                \[\leadsto e^{\left|m - n\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1 \]

              if 2.3e68 < l

              1. Initial program 92.7%

                \[\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. Add Preprocessing
              3. Taylor expanded in K around 0

                \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
              4. Step-by-step derivation
                1. *-commutativeN/A

                  \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                2. lower-*.f64N/A

                  \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
              5. Applied rewrites100.0%

                \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
              6. Taylor expanded in n around inf

                \[\leadsto e^{\left|m - n\right| - \left(\frac{1}{4} \cdot {n}^{2} + \ell\right)} \cdot \cos M \]
              7. Step-by-step derivation
                1. Applied rewrites97.6%

                  \[\leadsto e^{\left|m - n\right| - \left(\left(n \cdot n\right) \cdot 0.25 + \ell\right)} \cdot \cos M \]
              8. Recombined 3 regimes into one program.
              9. Final simplification93.3%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -8.8 \cdot 10^{+148}:\\ \;\;\;\;e^{\left|n - m\right| - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)} \cdot 1\\ \mathbf{elif}\;\ell \leq 2.3 \cdot 10^{+68}:\\ \;\;\;\;e^{\left|n - m\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;\cos M \cdot e^{\left|n - m\right| - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)}\\ \end{array} \]
              10. Add Preprocessing

              Alternative 3: 86.7% accurate, 1.5× speedup?

              \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|n - m\right|\\ t_1 := e^{t\_0 - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)} \cdot 1\\ \mathbf{if}\;\ell \leq -8.8 \cdot 10^{+148}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;\ell \leq 2.3 \cdot 10^{+68}:\\ \;\;\;\;e^{t\_0 - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
              (FPCore (K m n M l)
               :precision binary64
               (let* ((t_0 (fabs (- n m)))
                      (t_1 (* (exp (- t_0 (+ (* 0.25 (* n n)) l))) 1.0)))
                 (if (<= l -8.8e+148)
                   t_1
                   (if (<= l 2.3e+68)
                     (* (exp (- t_0 (pow (fma 0.5 (+ n m) (- M)) 2.0))) 1.0)
                     t_1))))
              double code(double K, double m, double n, double M, double l) {
              	double t_0 = fabs((n - m));
              	double t_1 = exp((t_0 - ((0.25 * (n * n)) + l))) * 1.0;
              	double tmp;
              	if (l <= -8.8e+148) {
              		tmp = t_1;
              	} else if (l <= 2.3e+68) {
              		tmp = exp((t_0 - pow(fma(0.5, (n + m), -M), 2.0))) * 1.0;
              	} else {
              		tmp = t_1;
              	}
              	return tmp;
              }
              
              function code(K, m, n, M, l)
              	t_0 = abs(Float64(n - m))
              	t_1 = Float64(exp(Float64(t_0 - Float64(Float64(0.25 * Float64(n * n)) + l))) * 1.0)
              	tmp = 0.0
              	if (l <= -8.8e+148)
              		tmp = t_1;
              	elseif (l <= 2.3e+68)
              		tmp = Float64(exp(Float64(t_0 - (fma(0.5, Float64(n + m), Float64(-M)) ^ 2.0))) * 1.0);
              	else
              		tmp = t_1;
              	end
              	return tmp
              end
              
              code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[N[(t$95$0 - N[(N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[l, -8.8e+148], t$95$1, If[LessEqual[l, 2.3e+68], N[(N[Exp[N[(t$95$0 - N[Power[N[(0.5 * N[(n + m), $MachinePrecision] + (-M)), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]
              
              \begin{array}{l}
              
              \\
              \begin{array}{l}
              t_0 := \left|n - m\right|\\
              t_1 := e^{t\_0 - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)} \cdot 1\\
              \mathbf{if}\;\ell \leq -8.8 \cdot 10^{+148}:\\
              \;\;\;\;t\_1\\
              
              \mathbf{elif}\;\ell \leq 2.3 \cdot 10^{+68}:\\
              \;\;\;\;e^{t\_0 - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1\\
              
              \mathbf{else}:\\
              \;\;\;\;t\_1\\
              
              
              \end{array}
              \end{array}
              
              Derivation
              1. Split input into 2 regimes
              2. if l < -8.7999999999999995e148 or 2.3e68 < l

                1. Initial program 82.4%

                  \[\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. Add Preprocessing
                3. Taylor expanded in K around 0

                  \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                4. Step-by-step derivation
                  1. *-commutativeN/A

                    \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                  2. lower-*.f64N/A

                    \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                5. Applied rewrites97.3%

                  \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                6. Taylor expanded in M around 0

                  \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                7. Step-by-step derivation
                  1. Applied rewrites98.6%

                    \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                  2. Taylor expanded in n around inf

                    \[\leadsto e^{\left|m - n\right| - \left(\frac{1}{4} \cdot {n}^{2} + \ell\right)} \cdot 1 \]
                  3. Step-by-step derivation
                    1. Applied rewrites88.0%

                      \[\leadsto e^{\left|m - n\right| - \left(\left(n \cdot n\right) \cdot 0.25 + \ell\right)} \cdot 1 \]

                    if -8.7999999999999995e148 < l < 2.3e68

                    1. Initial program 73.8%

                      \[\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. Add Preprocessing
                    3. Taylor expanded in K around 0

                      \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                    4. Step-by-step derivation
                      1. *-commutativeN/A

                        \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                      2. lower-*.f64N/A

                        \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                    5. Applied rewrites97.5%

                      \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                    6. Taylor expanded in M around 0

                      \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                    7. Step-by-step derivation
                      1. Applied rewrites97.5%

                        \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                      2. Taylor expanded in l around 0

                        \[\leadsto e^{\left|m - n\right| - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}} \cdot 1 \]
                      3. Step-by-step derivation
                        1. Applied rewrites95.4%

                          \[\leadsto e^{\left|m - n\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1 \]
                      4. Recombined 2 regimes into one program.
                      5. Final simplification93.3%

                        \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -8.8 \cdot 10^{+148}:\\ \;\;\;\;e^{\left|n - m\right| - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)} \cdot 1\\ \mathbf{elif}\;\ell \leq 2.3 \cdot 10^{+68}:\\ \;\;\;\;e^{\left|n - m\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\left|n - m\right| - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)} \cdot 1\\ \end{array} \]
                      6. Add Preprocessing

                      Alternative 4: 70.3% accurate, 2.6× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|n - m\right|\\ \mathbf{if}\;n \leq 5.3 \cdot 10^{-61}:\\ \;\;\;\;e^{t\_0 - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot 1\\ \mathbf{elif}\;n \leq 4 \cdot 10^{+28}:\\ \;\;\;\;e^{t\_0 - \left(M \cdot M + \ell\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{t\_0 - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)} \cdot 1\\ \end{array} \end{array} \]
                      (FPCore (K m n M l)
                       :precision binary64
                       (let* ((t_0 (fabs (- n m))))
                         (if (<= n 5.3e-61)
                           (* (exp (- t_0 (+ (* (* m m) 0.25) l))) 1.0)
                           (if (<= n 4e+28)
                             (* (exp (- t_0 (+ (* M M) l))) 1.0)
                             (* (exp (- t_0 (+ (* 0.25 (* n n)) l))) 1.0)))))
                      double code(double K, double m, double n, double M, double l) {
                      	double t_0 = fabs((n - m));
                      	double tmp;
                      	if (n <= 5.3e-61) {
                      		tmp = exp((t_0 - (((m * m) * 0.25) + l))) * 1.0;
                      	} else if (n <= 4e+28) {
                      		tmp = exp((t_0 - ((M * M) + l))) * 1.0;
                      	} else {
                      		tmp = exp((t_0 - ((0.25 * (n * n)) + l))) * 1.0;
                      	}
                      	return tmp;
                      }
                      
                      real(8) function code(k, m, n, m_1, l)
                          real(8), intent (in) :: k
                          real(8), intent (in) :: m
                          real(8), intent (in) :: n
                          real(8), intent (in) :: m_1
                          real(8), intent (in) :: l
                          real(8) :: t_0
                          real(8) :: tmp
                          t_0 = abs((n - m))
                          if (n <= 5.3d-61) then
                              tmp = exp((t_0 - (((m * m) * 0.25d0) + l))) * 1.0d0
                          else if (n <= 4d+28) then
                              tmp = exp((t_0 - ((m_1 * m_1) + l))) * 1.0d0
                          else
                              tmp = exp((t_0 - ((0.25d0 * (n * n)) + l))) * 1.0d0
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double K, double m, double n, double M, double l) {
                      	double t_0 = Math.abs((n - m));
                      	double tmp;
                      	if (n <= 5.3e-61) {
                      		tmp = Math.exp((t_0 - (((m * m) * 0.25) + l))) * 1.0;
                      	} else if (n <= 4e+28) {
                      		tmp = Math.exp((t_0 - ((M * M) + l))) * 1.0;
                      	} else {
                      		tmp = Math.exp((t_0 - ((0.25 * (n * n)) + l))) * 1.0;
                      	}
                      	return tmp;
                      }
                      
                      def code(K, m, n, M, l):
                      	t_0 = math.fabs((n - m))
                      	tmp = 0
                      	if n <= 5.3e-61:
                      		tmp = math.exp((t_0 - (((m * m) * 0.25) + l))) * 1.0
                      	elif n <= 4e+28:
                      		tmp = math.exp((t_0 - ((M * M) + l))) * 1.0
                      	else:
                      		tmp = math.exp((t_0 - ((0.25 * (n * n)) + l))) * 1.0
                      	return tmp
                      
                      function code(K, m, n, M, l)
                      	t_0 = abs(Float64(n - m))
                      	tmp = 0.0
                      	if (n <= 5.3e-61)
                      		tmp = Float64(exp(Float64(t_0 - Float64(Float64(Float64(m * m) * 0.25) + l))) * 1.0);
                      	elseif (n <= 4e+28)
                      		tmp = Float64(exp(Float64(t_0 - Float64(Float64(M * M) + l))) * 1.0);
                      	else
                      		tmp = Float64(exp(Float64(t_0 - Float64(Float64(0.25 * Float64(n * n)) + l))) * 1.0);
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(K, m, n, M, l)
                      	t_0 = abs((n - m));
                      	tmp = 0.0;
                      	if (n <= 5.3e-61)
                      		tmp = exp((t_0 - (((m * m) * 0.25) + l))) * 1.0;
                      	elseif (n <= 4e+28)
                      		tmp = exp((t_0 - ((M * M) + l))) * 1.0;
                      	else
                      		tmp = exp((t_0 - ((0.25 * (n * n)) + l))) * 1.0;
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, 5.3e-61], N[(N[Exp[N[(t$95$0 - N[(N[(N[(m * m), $MachinePrecision] * 0.25), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[n, 4e+28], N[(N[Exp[N[(t$95$0 - N[(N[(M * M), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Exp[N[(t$95$0 - N[(N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      t_0 := \left|n - m\right|\\
                      \mathbf{if}\;n \leq 5.3 \cdot 10^{-61}:\\
                      \;\;\;\;e^{t\_0 - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot 1\\
                      
                      \mathbf{elif}\;n \leq 4 \cdot 10^{+28}:\\
                      \;\;\;\;e^{t\_0 - \left(M \cdot M + \ell\right)} \cdot 1\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;e^{t\_0 - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)} \cdot 1\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if n < 5.3e-61

                        1. Initial program 80.4%

                          \[\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. Add Preprocessing
                        3. Taylor expanded in K around 0

                          \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                        4. Step-by-step derivation
                          1. *-commutativeN/A

                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                          2. lower-*.f64N/A

                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                        5. Applied rewrites96.6%

                          \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                        6. Taylor expanded in M around 0

                          \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                        7. Step-by-step derivation
                          1. Applied rewrites97.2%

                            \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                          2. Taylor expanded in m around inf

                            \[\leadsto e^{\left|m - n\right| - \left(\frac{1}{4} \cdot {m}^{2} + \ell\right)} \cdot 1 \]
                          3. Step-by-step derivation
                            1. Applied rewrites67.2%

                              \[\leadsto e^{\left|m - n\right| - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot 1 \]

                            if 5.3e-61 < n < 3.99999999999999983e28

                            1. Initial program 76.6%

                              \[\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. Add Preprocessing
                            3. Taylor expanded in K around 0

                              \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                            4. Step-by-step derivation
                              1. *-commutativeN/A

                                \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                              2. lower-*.f64N/A

                                \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                            5. Applied rewrites95.3%

                              \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                            6. Taylor expanded in M around 0

                              \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                            7. Step-by-step derivation
                              1. Applied rewrites95.3%

                                \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                              2. Taylor expanded in M around inf

                                \[\leadsto e^{\left|m - n\right| - \left({M}^{2} + \ell\right)} \cdot 1 \]
                              3. Step-by-step derivation
                                1. Applied rewrites60.5%

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

                                if 3.99999999999999983e28 < n

                                1. Initial program 66.7%

                                  \[\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. Add Preprocessing
                                3. Taylor expanded in K around 0

                                  \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                4. Step-by-step derivation
                                  1. *-commutativeN/A

                                    \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                  2. lower-*.f64N/A

                                    \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                5. Applied rewrites100.0%

                                  \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                6. Taylor expanded in M around 0

                                  \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                7. Step-by-step derivation
                                  1. Applied rewrites100.0%

                                    \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                  2. Taylor expanded in n around inf

                                    \[\leadsto e^{\left|m - n\right| - \left(\frac{1}{4} \cdot {n}^{2} + \ell\right)} \cdot 1 \]
                                  3. Step-by-step derivation
                                    1. Applied rewrites94.5%

                                      \[\leadsto e^{\left|m - n\right| - \left(\left(n \cdot n\right) \cdot 0.25 + \ell\right)} \cdot 1 \]
                                  4. Recombined 3 regimes into one program.
                                  5. Final simplification74.5%

                                    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 5.3 \cdot 10^{-61}:\\ \;\;\;\;e^{\left|n - m\right| - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot 1\\ \mathbf{elif}\;n \leq 4 \cdot 10^{+28}:\\ \;\;\;\;e^{\left|n - m\right| - \left(M \cdot M + \ell\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\left|n - m\right| - \left(0.25 \cdot \left(n \cdot n\right) + \ell\right)} \cdot 1\\ \end{array} \]
                                  6. Add Preprocessing

                                  Alternative 5: 69.9% accurate, 2.6× speedup?

                                  \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|n - m\right|\\ \mathbf{if}\;n \leq 5.3 \cdot 10^{-61}:\\ \;\;\;\;e^{t\_0 - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot 1\\ \mathbf{elif}\;n \leq 8.2 \cdot 10^{+52}:\\ \;\;\;\;e^{t\_0 - \left(M \cdot M + \ell\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{t\_0 - 0.25 \cdot \left(n \cdot n\right)} \cdot 1\\ \end{array} \end{array} \]
                                  (FPCore (K m n M l)
                                   :precision binary64
                                   (let* ((t_0 (fabs (- n m))))
                                     (if (<= n 5.3e-61)
                                       (* (exp (- t_0 (+ (* (* m m) 0.25) l))) 1.0)
                                       (if (<= n 8.2e+52)
                                         (* (exp (- t_0 (+ (* M M) l))) 1.0)
                                         (* (exp (- t_0 (* 0.25 (* n n)))) 1.0)))))
                                  double code(double K, double m, double n, double M, double l) {
                                  	double t_0 = fabs((n - m));
                                  	double tmp;
                                  	if (n <= 5.3e-61) {
                                  		tmp = exp((t_0 - (((m * m) * 0.25) + l))) * 1.0;
                                  	} else if (n <= 8.2e+52) {
                                  		tmp = exp((t_0 - ((M * M) + l))) * 1.0;
                                  	} else {
                                  		tmp = exp((t_0 - (0.25 * (n * n)))) * 1.0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  real(8) function code(k, m, n, m_1, l)
                                      real(8), intent (in) :: k
                                      real(8), intent (in) :: m
                                      real(8), intent (in) :: n
                                      real(8), intent (in) :: m_1
                                      real(8), intent (in) :: l
                                      real(8) :: t_0
                                      real(8) :: tmp
                                      t_0 = abs((n - m))
                                      if (n <= 5.3d-61) then
                                          tmp = exp((t_0 - (((m * m) * 0.25d0) + l))) * 1.0d0
                                      else if (n <= 8.2d+52) then
                                          tmp = exp((t_0 - ((m_1 * m_1) + l))) * 1.0d0
                                      else
                                          tmp = exp((t_0 - (0.25d0 * (n * n)))) * 1.0d0
                                      end if
                                      code = tmp
                                  end function
                                  
                                  public static double code(double K, double m, double n, double M, double l) {
                                  	double t_0 = Math.abs((n - m));
                                  	double tmp;
                                  	if (n <= 5.3e-61) {
                                  		tmp = Math.exp((t_0 - (((m * m) * 0.25) + l))) * 1.0;
                                  	} else if (n <= 8.2e+52) {
                                  		tmp = Math.exp((t_0 - ((M * M) + l))) * 1.0;
                                  	} else {
                                  		tmp = Math.exp((t_0 - (0.25 * (n * n)))) * 1.0;
                                  	}
                                  	return tmp;
                                  }
                                  
                                  def code(K, m, n, M, l):
                                  	t_0 = math.fabs((n - m))
                                  	tmp = 0
                                  	if n <= 5.3e-61:
                                  		tmp = math.exp((t_0 - (((m * m) * 0.25) + l))) * 1.0
                                  	elif n <= 8.2e+52:
                                  		tmp = math.exp((t_0 - ((M * M) + l))) * 1.0
                                  	else:
                                  		tmp = math.exp((t_0 - (0.25 * (n * n)))) * 1.0
                                  	return tmp
                                  
                                  function code(K, m, n, M, l)
                                  	t_0 = abs(Float64(n - m))
                                  	tmp = 0.0
                                  	if (n <= 5.3e-61)
                                  		tmp = Float64(exp(Float64(t_0 - Float64(Float64(Float64(m * m) * 0.25) + l))) * 1.0);
                                  	elseif (n <= 8.2e+52)
                                  		tmp = Float64(exp(Float64(t_0 - Float64(Float64(M * M) + l))) * 1.0);
                                  	else
                                  		tmp = Float64(exp(Float64(t_0 - Float64(0.25 * Float64(n * n)))) * 1.0);
                                  	end
                                  	return tmp
                                  end
                                  
                                  function tmp_2 = code(K, m, n, M, l)
                                  	t_0 = abs((n - m));
                                  	tmp = 0.0;
                                  	if (n <= 5.3e-61)
                                  		tmp = exp((t_0 - (((m * m) * 0.25) + l))) * 1.0;
                                  	elseif (n <= 8.2e+52)
                                  		tmp = exp((t_0 - ((M * M) + l))) * 1.0;
                                  	else
                                  		tmp = exp((t_0 - (0.25 * (n * n)))) * 1.0;
                                  	end
                                  	tmp_2 = tmp;
                                  end
                                  
                                  code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, 5.3e-61], N[(N[Exp[N[(t$95$0 - N[(N[(N[(m * m), $MachinePrecision] * 0.25), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[n, 8.2e+52], N[(N[Exp[N[(t$95$0 - N[(N[(M * M), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Exp[N[(t$95$0 - N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  \begin{array}{l}
                                  t_0 := \left|n - m\right|\\
                                  \mathbf{if}\;n \leq 5.3 \cdot 10^{-61}:\\
                                  \;\;\;\;e^{t\_0 - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot 1\\
                                  
                                  \mathbf{elif}\;n \leq 8.2 \cdot 10^{+52}:\\
                                  \;\;\;\;e^{t\_0 - \left(M \cdot M + \ell\right)} \cdot 1\\
                                  
                                  \mathbf{else}:\\
                                  \;\;\;\;e^{t\_0 - 0.25 \cdot \left(n \cdot n\right)} \cdot 1\\
                                  
                                  
                                  \end{array}
                                  \end{array}
                                  
                                  Derivation
                                  1. Split input into 3 regimes
                                  2. if n < 5.3e-61

                                    1. Initial program 80.4%

                                      \[\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. Add Preprocessing
                                    3. Taylor expanded in K around 0

                                      \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                    4. Step-by-step derivation
                                      1. *-commutativeN/A

                                        \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                      2. lower-*.f64N/A

                                        \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                    5. Applied rewrites96.6%

                                      \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                    6. Taylor expanded in M around 0

                                      \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                    7. Step-by-step derivation
                                      1. Applied rewrites97.2%

                                        \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                      2. Taylor expanded in m around inf

                                        \[\leadsto e^{\left|m - n\right| - \left(\frac{1}{4} \cdot {m}^{2} + \ell\right)} \cdot 1 \]
                                      3. Step-by-step derivation
                                        1. Applied rewrites67.2%

                                          \[\leadsto e^{\left|m - n\right| - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot 1 \]

                                        if 5.3e-61 < n < 8.1999999999999999e52

                                        1. Initial program 76.1%

                                          \[\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. Add Preprocessing
                                        3. Taylor expanded in K around 0

                                          \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                        4. Step-by-step derivation
                                          1. *-commutativeN/A

                                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                          2. lower-*.f64N/A

                                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                        5. Applied rewrites96.8%

                                          \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                        6. Taylor expanded in M around 0

                                          \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                        7. Step-by-step derivation
                                          1. Applied rewrites96.8%

                                            \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                          2. Taylor expanded in M around inf

                                            \[\leadsto e^{\left|m - n\right| - \left({M}^{2} + \ell\right)} \cdot 1 \]
                                          3. Step-by-step derivation
                                            1. Applied rewrites69.2%

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

                                            if 8.1999999999999999e52 < n

                                            1. Initial program 65.6%

                                              \[\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. Add Preprocessing
                                            3. Taylor expanded in K around 0

                                              \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                            4. Step-by-step derivation
                                              1. *-commutativeN/A

                                                \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                              2. lower-*.f64N/A

                                                \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                            5. Applied rewrites100.0%

                                              \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                            6. Taylor expanded in M around 0

                                              \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                            7. Step-by-step derivation
                                              1. Applied rewrites100.0%

                                                \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                              2. Taylor expanded in l around 0

                                                \[\leadsto e^{\left|m - n\right| - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}} \cdot 1 \]
                                              3. Step-by-step derivation
                                                1. Applied rewrites100.0%

                                                  \[\leadsto e^{\left|m - n\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1 \]
                                                2. Taylor expanded in n around inf

                                                  \[\leadsto e^{\left|m - n\right| - \frac{1}{4} \cdot {n}^{2}} \cdot 1 \]
                                                3. Step-by-step derivation
                                                  1. Applied rewrites96.9%

                                                    \[\leadsto e^{\left|m - n\right| - \left(n \cdot n\right) \cdot 0.25} \cdot 1 \]
                                                4. Recombined 3 regimes into one program.
                                                5. Final simplification74.9%

                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 5.3 \cdot 10^{-61}:\\ \;\;\;\;e^{\left|n - m\right| - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot 1\\ \mathbf{elif}\;n \leq 8.2 \cdot 10^{+52}:\\ \;\;\;\;e^{\left|n - m\right| - \left(M \cdot M + \ell\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\left|n - m\right| - 0.25 \cdot \left(n \cdot n\right)} \cdot 1\\ \end{array} \]
                                                6. Add Preprocessing

                                                Alternative 6: 61.6% accurate, 2.6× speedup?

                                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|n - m\right|\\ \mathbf{if}\;n \leq 4.2 \cdot 10^{-295}:\\ \;\;\;\;e^{t\_0 - \left(m \cdot m\right) \cdot 0.25} \cdot 1\\ \mathbf{elif}\;n \leq 8.2 \cdot 10^{+52}:\\ \;\;\;\;e^{t\_0 - \left(M \cdot M + \ell\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{t\_0 - 0.25 \cdot \left(n \cdot n\right)} \cdot 1\\ \end{array} \end{array} \]
                                                (FPCore (K m n M l)
                                                 :precision binary64
                                                 (let* ((t_0 (fabs (- n m))))
                                                   (if (<= n 4.2e-295)
                                                     (* (exp (- t_0 (* (* m m) 0.25))) 1.0)
                                                     (if (<= n 8.2e+52)
                                                       (* (exp (- t_0 (+ (* M M) l))) 1.0)
                                                       (* (exp (- t_0 (* 0.25 (* n n)))) 1.0)))))
                                                double code(double K, double m, double n, double M, double l) {
                                                	double t_0 = fabs((n - m));
                                                	double tmp;
                                                	if (n <= 4.2e-295) {
                                                		tmp = exp((t_0 - ((m * m) * 0.25))) * 1.0;
                                                	} else if (n <= 8.2e+52) {
                                                		tmp = exp((t_0 - ((M * M) + l))) * 1.0;
                                                	} else {
                                                		tmp = exp((t_0 - (0.25 * (n * n)))) * 1.0;
                                                	}
                                                	return tmp;
                                                }
                                                
                                                real(8) function code(k, m, n, m_1, l)
                                                    real(8), intent (in) :: k
                                                    real(8), intent (in) :: m
                                                    real(8), intent (in) :: n
                                                    real(8), intent (in) :: m_1
                                                    real(8), intent (in) :: l
                                                    real(8) :: t_0
                                                    real(8) :: tmp
                                                    t_0 = abs((n - m))
                                                    if (n <= 4.2d-295) then
                                                        tmp = exp((t_0 - ((m * m) * 0.25d0))) * 1.0d0
                                                    else if (n <= 8.2d+52) then
                                                        tmp = exp((t_0 - ((m_1 * m_1) + l))) * 1.0d0
                                                    else
                                                        tmp = exp((t_0 - (0.25d0 * (n * n)))) * 1.0d0
                                                    end if
                                                    code = tmp
                                                end function
                                                
                                                public static double code(double K, double m, double n, double M, double l) {
                                                	double t_0 = Math.abs((n - m));
                                                	double tmp;
                                                	if (n <= 4.2e-295) {
                                                		tmp = Math.exp((t_0 - ((m * m) * 0.25))) * 1.0;
                                                	} else if (n <= 8.2e+52) {
                                                		tmp = Math.exp((t_0 - ((M * M) + l))) * 1.0;
                                                	} else {
                                                		tmp = Math.exp((t_0 - (0.25 * (n * n)))) * 1.0;
                                                	}
                                                	return tmp;
                                                }
                                                
                                                def code(K, m, n, M, l):
                                                	t_0 = math.fabs((n - m))
                                                	tmp = 0
                                                	if n <= 4.2e-295:
                                                		tmp = math.exp((t_0 - ((m * m) * 0.25))) * 1.0
                                                	elif n <= 8.2e+52:
                                                		tmp = math.exp((t_0 - ((M * M) + l))) * 1.0
                                                	else:
                                                		tmp = math.exp((t_0 - (0.25 * (n * n)))) * 1.0
                                                	return tmp
                                                
                                                function code(K, m, n, M, l)
                                                	t_0 = abs(Float64(n - m))
                                                	tmp = 0.0
                                                	if (n <= 4.2e-295)
                                                		tmp = Float64(exp(Float64(t_0 - Float64(Float64(m * m) * 0.25))) * 1.0);
                                                	elseif (n <= 8.2e+52)
                                                		tmp = Float64(exp(Float64(t_0 - Float64(Float64(M * M) + l))) * 1.0);
                                                	else
                                                		tmp = Float64(exp(Float64(t_0 - Float64(0.25 * Float64(n * n)))) * 1.0);
                                                	end
                                                	return tmp
                                                end
                                                
                                                function tmp_2 = code(K, m, n, M, l)
                                                	t_0 = abs((n - m));
                                                	tmp = 0.0;
                                                	if (n <= 4.2e-295)
                                                		tmp = exp((t_0 - ((m * m) * 0.25))) * 1.0;
                                                	elseif (n <= 8.2e+52)
                                                		tmp = exp((t_0 - ((M * M) + l))) * 1.0;
                                                	else
                                                		tmp = exp((t_0 - (0.25 * (n * n)))) * 1.0;
                                                	end
                                                	tmp_2 = tmp;
                                                end
                                                
                                                code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, 4.2e-295], N[(N[Exp[N[(t$95$0 - N[(N[(m * m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], If[LessEqual[n, 8.2e+52], N[(N[Exp[N[(t$95$0 - N[(N[(M * M), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], N[(N[Exp[N[(t$95$0 - N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]]]]
                                                
                                                \begin{array}{l}
                                                
                                                \\
                                                \begin{array}{l}
                                                t_0 := \left|n - m\right|\\
                                                \mathbf{if}\;n \leq 4.2 \cdot 10^{-295}:\\
                                                \;\;\;\;e^{t\_0 - \left(m \cdot m\right) \cdot 0.25} \cdot 1\\
                                                
                                                \mathbf{elif}\;n \leq 8.2 \cdot 10^{+52}:\\
                                                \;\;\;\;e^{t\_0 - \left(M \cdot M + \ell\right)} \cdot 1\\
                                                
                                                \mathbf{else}:\\
                                                \;\;\;\;e^{t\_0 - 0.25 \cdot \left(n \cdot n\right)} \cdot 1\\
                                                
                                                
                                                \end{array}
                                                \end{array}
                                                
                                                Derivation
                                                1. Split input into 3 regimes
                                                2. if n < 4.19999999999999986e-295

                                                  1. Initial program 76.0%

                                                    \[\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. Add Preprocessing
                                                  3. Taylor expanded in K around 0

                                                    \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                                  4. Step-by-step derivation
                                                    1. *-commutativeN/A

                                                      \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                    2. lower-*.f64N/A

                                                      \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                  5. Applied rewrites95.4%

                                                    \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                                  6. Taylor expanded in M around 0

                                                    \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                  7. Step-by-step derivation
                                                    1. Applied rewrites96.2%

                                                      \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                    2. Taylor expanded in l around 0

                                                      \[\leadsto e^{\left|m - n\right| - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}} \cdot 1 \]
                                                    3. Step-by-step derivation
                                                      1. Applied rewrites83.6%

                                                        \[\leadsto e^{\left|m - n\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1 \]
                                                      2. Taylor expanded in m around inf

                                                        \[\leadsto e^{\left|m - n\right| - \frac{1}{4} \cdot {m}^{2}} \cdot 1 \]
                                                      3. Step-by-step derivation
                                                        1. Applied rewrites55.2%

                                                          \[\leadsto e^{\left|m - n\right| - \left(m \cdot m\right) \cdot 0.25} \cdot 1 \]

                                                        if 4.19999999999999986e-295 < n < 8.1999999999999999e52

                                                        1. Initial program 86.8%

                                                          \[\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. Add Preprocessing
                                                        3. Taylor expanded in K around 0

                                                          \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                                        4. Step-by-step derivation
                                                          1. *-commutativeN/A

                                                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                          2. lower-*.f64N/A

                                                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                        5. Applied rewrites98.8%

                                                          \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                                        6. Taylor expanded in M around 0

                                                          \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                        7. Step-by-step derivation
                                                          1. Applied rewrites98.8%

                                                            \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                          2. Taylor expanded in M around inf

                                                            \[\leadsto e^{\left|m - n\right| - \left({M}^{2} + \ell\right)} \cdot 1 \]
                                                          3. Step-by-step derivation
                                                            1. Applied rewrites76.8%

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

                                                            if 8.1999999999999999e52 < n

                                                            1. Initial program 65.6%

                                                              \[\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. Add Preprocessing
                                                            3. Taylor expanded in K around 0

                                                              \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                                            4. Step-by-step derivation
                                                              1. *-commutativeN/A

                                                                \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                              2. lower-*.f64N/A

                                                                \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                            5. Applied rewrites100.0%

                                                              \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                                            6. Taylor expanded in M around 0

                                                              \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                            7. Step-by-step derivation
                                                              1. Applied rewrites100.0%

                                                                \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                              2. Taylor expanded in l around 0

                                                                \[\leadsto e^{\left|m - n\right| - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}} \cdot 1 \]
                                                              3. Step-by-step derivation
                                                                1. Applied rewrites100.0%

                                                                  \[\leadsto e^{\left|m - n\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1 \]
                                                                2. Taylor expanded in n around inf

                                                                  \[\leadsto e^{\left|m - n\right| - \frac{1}{4} \cdot {n}^{2}} \cdot 1 \]
                                                                3. Step-by-step derivation
                                                                  1. Applied rewrites96.9%

                                                                    \[\leadsto e^{\left|m - n\right| - \left(n \cdot n\right) \cdot 0.25} \cdot 1 \]
                                                                4. Recombined 3 regimes into one program.
                                                                5. Final simplification71.4%

                                                                  \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 4.2 \cdot 10^{-295}:\\ \;\;\;\;e^{\left|n - m\right| - \left(m \cdot m\right) \cdot 0.25} \cdot 1\\ \mathbf{elif}\;n \leq 8.2 \cdot 10^{+52}:\\ \;\;\;\;e^{\left|n - m\right| - \left(M \cdot M + \ell\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\left|n - m\right| - 0.25 \cdot \left(n \cdot n\right)} \cdot 1\\ \end{array} \]
                                                                6. Add Preprocessing

                                                                Alternative 7: 76.1% accurate, 2.6× speedup?

                                                                \[\begin{array}{l} \\ \begin{array}{l} t_0 := \left|n - m\right|\\ t_1 := e^{t\_0 - \left(m \cdot m\right) \cdot 0.25} \cdot 1\\ \mathbf{if}\;m \leq -5 \cdot 10^{+39}:\\ \;\;\;\;t\_1\\ \mathbf{elif}\;m \leq 4 \cdot 10^{+81}:\\ \;\;\;\;e^{t\_0 - \left(M \cdot M + \ell\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;t\_1\\ \end{array} \end{array} \]
                                                                (FPCore (K m n M l)
                                                                 :precision binary64
                                                                 (let* ((t_0 (fabs (- n m))) (t_1 (* (exp (- t_0 (* (* m m) 0.25))) 1.0)))
                                                                   (if (<= m -5e+39)
                                                                     t_1
                                                                     (if (<= m 4e+81) (* (exp (- t_0 (+ (* M M) l))) 1.0) t_1))))
                                                                double code(double K, double m, double n, double M, double l) {
                                                                	double t_0 = fabs((n - m));
                                                                	double t_1 = exp((t_0 - ((m * m) * 0.25))) * 1.0;
                                                                	double tmp;
                                                                	if (m <= -5e+39) {
                                                                		tmp = t_1;
                                                                	} else if (m <= 4e+81) {
                                                                		tmp = exp((t_0 - ((M * M) + l))) * 1.0;
                                                                	} else {
                                                                		tmp = t_1;
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                real(8) function code(k, m, n, m_1, l)
                                                                    real(8), intent (in) :: k
                                                                    real(8), intent (in) :: m
                                                                    real(8), intent (in) :: n
                                                                    real(8), intent (in) :: m_1
                                                                    real(8), intent (in) :: l
                                                                    real(8) :: t_0
                                                                    real(8) :: t_1
                                                                    real(8) :: tmp
                                                                    t_0 = abs((n - m))
                                                                    t_1 = exp((t_0 - ((m * m) * 0.25d0))) * 1.0d0
                                                                    if (m <= (-5d+39)) then
                                                                        tmp = t_1
                                                                    else if (m <= 4d+81) then
                                                                        tmp = exp((t_0 - ((m_1 * m_1) + l))) * 1.0d0
                                                                    else
                                                                        tmp = t_1
                                                                    end if
                                                                    code = tmp
                                                                end function
                                                                
                                                                public static double code(double K, double m, double n, double M, double l) {
                                                                	double t_0 = Math.abs((n - m));
                                                                	double t_1 = Math.exp((t_0 - ((m * m) * 0.25))) * 1.0;
                                                                	double tmp;
                                                                	if (m <= -5e+39) {
                                                                		tmp = t_1;
                                                                	} else if (m <= 4e+81) {
                                                                		tmp = Math.exp((t_0 - ((M * M) + l))) * 1.0;
                                                                	} else {
                                                                		tmp = t_1;
                                                                	}
                                                                	return tmp;
                                                                }
                                                                
                                                                def code(K, m, n, M, l):
                                                                	t_0 = math.fabs((n - m))
                                                                	t_1 = math.exp((t_0 - ((m * m) * 0.25))) * 1.0
                                                                	tmp = 0
                                                                	if m <= -5e+39:
                                                                		tmp = t_1
                                                                	elif m <= 4e+81:
                                                                		tmp = math.exp((t_0 - ((M * M) + l))) * 1.0
                                                                	else:
                                                                		tmp = t_1
                                                                	return tmp
                                                                
                                                                function code(K, m, n, M, l)
                                                                	t_0 = abs(Float64(n - m))
                                                                	t_1 = Float64(exp(Float64(t_0 - Float64(Float64(m * m) * 0.25))) * 1.0)
                                                                	tmp = 0.0
                                                                	if (m <= -5e+39)
                                                                		tmp = t_1;
                                                                	elseif (m <= 4e+81)
                                                                		tmp = Float64(exp(Float64(t_0 - Float64(Float64(M * M) + l))) * 1.0);
                                                                	else
                                                                		tmp = t_1;
                                                                	end
                                                                	return tmp
                                                                end
                                                                
                                                                function tmp_2 = code(K, m, n, M, l)
                                                                	t_0 = abs((n - m));
                                                                	t_1 = exp((t_0 - ((m * m) * 0.25))) * 1.0;
                                                                	tmp = 0.0;
                                                                	if (m <= -5e+39)
                                                                		tmp = t_1;
                                                                	elseif (m <= 4e+81)
                                                                		tmp = exp((t_0 - ((M * M) + l))) * 1.0;
                                                                	else
                                                                		tmp = t_1;
                                                                	end
                                                                	tmp_2 = tmp;
                                                                end
                                                                
                                                                code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[N[(t$95$0 - N[(N[(m * m), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[m, -5e+39], t$95$1, If[LessEqual[m, 4e+81], N[(N[Exp[N[(t$95$0 - N[(N[(M * M), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision], t$95$1]]]]
                                                                
                                                                \begin{array}{l}
                                                                
                                                                \\
                                                                \begin{array}{l}
                                                                t_0 := \left|n - m\right|\\
                                                                t_1 := e^{t\_0 - \left(m \cdot m\right) \cdot 0.25} \cdot 1\\
                                                                \mathbf{if}\;m \leq -5 \cdot 10^{+39}:\\
                                                                \;\;\;\;t\_1\\
                                                                
                                                                \mathbf{elif}\;m \leq 4 \cdot 10^{+81}:\\
                                                                \;\;\;\;e^{t\_0 - \left(M \cdot M + \ell\right)} \cdot 1\\
                                                                
                                                                \mathbf{else}:\\
                                                                \;\;\;\;t\_1\\
                                                                
                                                                
                                                                \end{array}
                                                                \end{array}
                                                                
                                                                Derivation
                                                                1. Split input into 2 regimes
                                                                2. if m < -5.00000000000000015e39 or 3.99999999999999969e81 < m

                                                                  1. Initial program 73.4%

                                                                    \[\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. Add Preprocessing
                                                                  3. Taylor expanded in K around 0

                                                                    \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                                                  4. Step-by-step derivation
                                                                    1. *-commutativeN/A

                                                                      \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                                    2. lower-*.f64N/A

                                                                      \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                                  5. Applied rewrites100.0%

                                                                    \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                                                  6. Taylor expanded in M around 0

                                                                    \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                                  7. Step-by-step derivation
                                                                    1. Applied rewrites100.0%

                                                                      \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                                    2. Taylor expanded in l around 0

                                                                      \[\leadsto e^{\left|m - n\right| - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}} \cdot 1 \]
                                                                    3. Step-by-step derivation
                                                                      1. Applied rewrites97.9%

                                                                        \[\leadsto e^{\left|m - n\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1 \]
                                                                      2. Taylor expanded in m around inf

                                                                        \[\leadsto e^{\left|m - n\right| - \frac{1}{4} \cdot {m}^{2}} \cdot 1 \]
                                                                      3. Step-by-step derivation
                                                                        1. Applied rewrites91.6%

                                                                          \[\leadsto e^{\left|m - n\right| - \left(m \cdot m\right) \cdot 0.25} \cdot 1 \]

                                                                        if -5.00000000000000015e39 < m < 3.99999999999999969e81

                                                                        1. Initial program 77.9%

                                                                          \[\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. Add Preprocessing
                                                                        3. Taylor expanded in K around 0

                                                                          \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                                                        4. Step-by-step derivation
                                                                          1. *-commutativeN/A

                                                                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                                          2. lower-*.f64N/A

                                                                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                                        5. Applied rewrites96.0%

                                                                          \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                                                        6. Taylor expanded in M around 0

                                                                          \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                                        7. Step-by-step derivation
                                                                          1. Applied rewrites96.6%

                                                                            \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                                          2. Taylor expanded in M around inf

                                                                            \[\leadsto e^{\left|m - n\right| - \left({M}^{2} + \ell\right)} \cdot 1 \]
                                                                          3. Step-by-step derivation
                                                                            1. Applied rewrites66.1%

                                                                              \[\leadsto e^{\left|m - n\right| - \left(M \cdot M + \ell\right)} \cdot 1 \]
                                                                          4. Recombined 2 regimes into one program.
                                                                          5. Final simplification75.5%

                                                                            \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -5 \cdot 10^{+39}:\\ \;\;\;\;e^{\left|n - m\right| - \left(m \cdot m\right) \cdot 0.25} \cdot 1\\ \mathbf{elif}\;m \leq 4 \cdot 10^{+81}:\\ \;\;\;\;e^{\left|n - m\right| - \left(M \cdot M + \ell\right)} \cdot 1\\ \mathbf{else}:\\ \;\;\;\;e^{\left|n - m\right| - \left(m \cdot m\right) \cdot 0.25} \cdot 1\\ \end{array} \]
                                                                          6. Add Preprocessing

                                                                          Alternative 8: 55.0% accurate, 2.9× speedup?

                                                                          \[\begin{array}{l} \\ e^{\left|n - m\right| - \left(M \cdot M + \ell\right)} \cdot 1 \end{array} \]
                                                                          (FPCore (K m n M l)
                                                                           :precision binary64
                                                                           (* (exp (- (fabs (- n m)) (+ (* M M) l))) 1.0))
                                                                          double code(double K, double m, double n, double M, double l) {
                                                                          	return exp((fabs((n - m)) - ((M * M) + l))) * 1.0;
                                                                          }
                                                                          
                                                                          real(8) function code(k, m, n, m_1, l)
                                                                              real(8), intent (in) :: k
                                                                              real(8), intent (in) :: m
                                                                              real(8), intent (in) :: n
                                                                              real(8), intent (in) :: m_1
                                                                              real(8), intent (in) :: l
                                                                              code = exp((abs((n - m)) - ((m_1 * m_1) + l))) * 1.0d0
                                                                          end function
                                                                          
                                                                          public static double code(double K, double m, double n, double M, double l) {
                                                                          	return Math.exp((Math.abs((n - m)) - ((M * M) + l))) * 1.0;
                                                                          }
                                                                          
                                                                          def code(K, m, n, M, l):
                                                                          	return math.exp((math.fabs((n - m)) - ((M * M) + l))) * 1.0
                                                                          
                                                                          function code(K, m, n, M, l)
                                                                          	return Float64(exp(Float64(abs(Float64(n - m)) - Float64(Float64(M * M) + l))) * 1.0)
                                                                          end
                                                                          
                                                                          function tmp = code(K, m, n, M, l)
                                                                          	tmp = exp((abs((n - m)) - ((M * M) + l))) * 1.0;
                                                                          end
                                                                          
                                                                          code[K_, m_, n_, M_, l_] := N[(N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(N[(M * M), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]
                                                                          
                                                                          \begin{array}{l}
                                                                          
                                                                          \\
                                                                          e^{\left|n - m\right| - \left(M \cdot M + \ell\right)} \cdot 1
                                                                          \end{array}
                                                                          
                                                                          Derivation
                                                                          1. Initial program 76.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. Add Preprocessing
                                                                          3. Taylor expanded in K around 0

                                                                            \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                                                          4. Step-by-step derivation
                                                                            1. *-commutativeN/A

                                                                              \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                                            2. lower-*.f64N/A

                                                                              \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                                          5. Applied rewrites97.5%

                                                                            \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                                                          6. Taylor expanded in M around 0

                                                                            \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                                          7. Step-by-step derivation
                                                                            1. Applied rewrites97.8%

                                                                              \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                                            2. Taylor expanded in M around inf

                                                                              \[\leadsto e^{\left|m - n\right| - \left({M}^{2} + \ell\right)} \cdot 1 \]
                                                                            3. Step-by-step derivation
                                                                              1. Applied rewrites55.5%

                                                                                \[\leadsto e^{\left|m - n\right| - \left(M \cdot M + \ell\right)} \cdot 1 \]
                                                                              2. Final simplification55.5%

                                                                                \[\leadsto e^{\left|n - m\right| - \left(M \cdot M + \ell\right)} \cdot 1 \]
                                                                              3. Add Preprocessing

                                                                              Alternative 9: 44.2% accurate, 3.0× speedup?

                                                                              \[\begin{array}{l} \\ e^{\left|n - m\right| - M \cdot M} \cdot 1 \end{array} \]
                                                                              (FPCore (K m n M l)
                                                                               :precision binary64
                                                                               (* (exp (- (fabs (- n m)) (* M M))) 1.0))
                                                                              double code(double K, double m, double n, double M, double l) {
                                                                              	return exp((fabs((n - m)) - (M * M))) * 1.0;
                                                                              }
                                                                              
                                                                              real(8) function code(k, m, n, m_1, l)
                                                                                  real(8), intent (in) :: k
                                                                                  real(8), intent (in) :: m
                                                                                  real(8), intent (in) :: n
                                                                                  real(8), intent (in) :: m_1
                                                                                  real(8), intent (in) :: l
                                                                                  code = exp((abs((n - m)) - (m_1 * m_1))) * 1.0d0
                                                                              end function
                                                                              
                                                                              public static double code(double K, double m, double n, double M, double l) {
                                                                              	return Math.exp((Math.abs((n - m)) - (M * M))) * 1.0;
                                                                              }
                                                                              
                                                                              def code(K, m, n, M, l):
                                                                              	return math.exp((math.fabs((n - m)) - (M * M))) * 1.0
                                                                              
                                                                              function code(K, m, n, M, l)
                                                                              	return Float64(exp(Float64(abs(Float64(n - m)) - Float64(M * M))) * 1.0)
                                                                              end
                                                                              
                                                                              function tmp = code(K, m, n, M, l)
                                                                              	tmp = exp((abs((n - m)) - (M * M))) * 1.0;
                                                                              end
                                                                              
                                                                              code[K_, m_, n_, M_, l_] := N[(N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * 1.0), $MachinePrecision]
                                                                              
                                                                              \begin{array}{l}
                                                                              
                                                                              \\
                                                                              e^{\left|n - m\right| - M \cdot M} \cdot 1
                                                                              \end{array}
                                                                              
                                                                              Derivation
                                                                              1. Initial program 76.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. Add Preprocessing
                                                                              3. Taylor expanded in K around 0

                                                                                \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
                                                                              4. Step-by-step derivation
                                                                                1. *-commutativeN/A

                                                                                  \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                                                2. lower-*.f64N/A

                                                                                  \[\leadsto \color{blue}{e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)} \cdot \cos \left(\mathsf{neg}\left(M\right)\right)} \]
                                                                              5. Applied rewrites97.5%

                                                                                \[\leadsto \color{blue}{e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M} \]
                                                                              6. Taylor expanded in M around 0

                                                                                \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(\frac{1}{2}, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                                              7. Step-by-step derivation
                                                                                1. Applied rewrites97.8%

                                                                                  \[\leadsto e^{\left|m - n\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)} \cdot 1 \]
                                                                                2. Taylor expanded in l around 0

                                                                                  \[\leadsto e^{\left|m - n\right| - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}} \cdot 1 \]
                                                                                3. Step-by-step derivation
                                                                                  1. Applied rewrites86.8%

                                                                                    \[\leadsto e^{\left|m - n\right| - {\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2}} \cdot 1 \]
                                                                                  2. Taylor expanded in M around inf

                                                                                    \[\leadsto e^{\left|m - n\right| - {M}^{2}} \cdot 1 \]
                                                                                  3. Step-by-step derivation
                                                                                    1. Applied rewrites43.7%

                                                                                      \[\leadsto e^{\left|m - n\right| - M \cdot M} \cdot 1 \]
                                                                                    2. Final simplification43.7%

                                                                                      \[\leadsto e^{\left|n - m\right| - M \cdot M} \cdot 1 \]
                                                                                    3. Add Preprocessing

                                                                                    Reproduce

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