Maksimov and Kolovsky, Equation (32)

Percentage Accurate: 76.2% → 95.0%
Time: 17.1s
Alternatives: 14
Speedup: 3.9×

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 14 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: 76.2% 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: 95.0% accurate, 1.8× speedup?

\[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} t_0 := \frac{n + m}{2} - M\\ \mathbf{if}\;m \leq -5.4 \cdot 10^{-35}:\\ \;\;\;\;e^{\left(\left|n - m\right| - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)\right) - \ell}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(\frac{1}{\frac{\frac{\frac{n \cdot -2}{m}}{K} + \frac{2}{K}}{m}} - M\right)}{e^{\ell + t\_0 \cdot t\_0}}\\ \end{array} \end{array} \]
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
 :precision binary64
 (let* ((t_0 (- (/ (+ n m) 2.0) M)))
   (if (<= m -5.4e-35)
     (exp (- (- (fabs (- n m)) (* 0.25 (* (+ n m) (+ n m)))) l))
     (/
      (cos (- (/ 1.0 (/ (+ (/ (/ (* n -2.0) m) K) (/ 2.0 K)) m)) M))
      (exp (+ l (* t_0 t_0)))))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
	double t_0 = ((n + m) / 2.0) - M;
	double tmp;
	if (m <= -5.4e-35) {
		tmp = exp(((fabs((n - m)) - (0.25 * ((n + m) * (n + m)))) - l));
	} else {
		tmp = cos(((1.0 / (((((n * -2.0) / m) / K) + (2.0 / K)) / m)) - M)) / exp((l + (t_0 * t_0)));
	}
	return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 = ((n + m) / 2.0d0) - m_1
    if (m <= (-5.4d-35)) then
        tmp = exp(((abs((n - m)) - (0.25d0 * ((n + m) * (n + m)))) - l))
    else
        tmp = cos(((1.0d0 / (((((n * (-2.0d0)) / m) / k) + (2.0d0 / k)) / m)) - m_1)) / exp((l + (t_0 * t_0)))
    end if
    code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
	double t_0 = ((n + m) / 2.0) - M;
	double tmp;
	if (m <= -5.4e-35) {
		tmp = Math.exp(((Math.abs((n - m)) - (0.25 * ((n + m) * (n + m)))) - l));
	} else {
		tmp = Math.cos(((1.0 / (((((n * -2.0) / m) / K) + (2.0 / K)) / m)) - M)) / Math.exp((l + (t_0 * t_0)));
	}
	return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l])
def code(K, m, n, M, l):
	t_0 = ((n + m) / 2.0) - M
	tmp = 0
	if m <= -5.4e-35:
		tmp = math.exp(((math.fabs((n - m)) - (0.25 * ((n + m) * (n + m)))) - l))
	else:
		tmp = math.cos(((1.0 / (((((n * -2.0) / m) / K) + (2.0 / K)) / m)) - M)) / math.exp((l + (t_0 * t_0)))
	return tmp
K, m, n, M, l = sort([K, m, n, M, l])
function code(K, m, n, M, l)
	t_0 = Float64(Float64(Float64(n + m) / 2.0) - M)
	tmp = 0.0
	if (m <= -5.4e-35)
		tmp = exp(Float64(Float64(abs(Float64(n - m)) - Float64(0.25 * Float64(Float64(n + m) * Float64(n + m)))) - l));
	else
		tmp = Float64(cos(Float64(Float64(1.0 / Float64(Float64(Float64(Float64(Float64(n * -2.0) / m) / K) + Float64(2.0 / K)) / m)) - M)) / exp(Float64(l + Float64(t_0 * t_0))));
	end
	return tmp
end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
	t_0 = ((n + m) / 2.0) - M;
	tmp = 0.0;
	if (m <= -5.4e-35)
		tmp = exp(((abs((n - m)) - (0.25 * ((n + m) * (n + m)))) - l));
	else
		tmp = cos(((1.0 / (((((n * -2.0) / m) / K) + (2.0 / K)) / m)) - M)) / exp((l + (t_0 * t_0)));
	end
	tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]}, If[LessEqual[m, -5.4e-35], N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(0.25 * N[(N[(n + m), $MachinePrecision] * N[(n + m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(N[(1.0 / N[(N[(N[(N[(N[(n * -2.0), $MachinePrecision] / m), $MachinePrecision] / K), $MachinePrecision] + N[(2.0 / K), $MachinePrecision]), $MachinePrecision] / m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(l + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := \frac{n + m}{2} - M\\
\mathbf{if}\;m \leq -5.4 \cdot 10^{-35}:\\
\;\;\;\;e^{\left(\left|n - m\right| - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)\right) - \ell}\\

\mathbf{else}:\\
\;\;\;\;\frac{\cos \left(\frac{1}{\frac{\frac{\frac{n \cdot -2}{m}}{K} + \frac{2}{K}}{m}} - M\right)}{e^{\ell + t\_0 \cdot t\_0}}\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -5.3999999999999995e-35

    1. Initial program 71.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. Step-by-step derivation
      1. neg-sub0N/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
      2. associate--l-N/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
      3. exp-diffN/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      4. associate-*r/N/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      5. exp-0N/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
      6. *-rgt-identityN/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
    3. Simplified71.8%

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      13. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      16. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      17. fabs-subN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
    7. Simplified97.6%

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

      \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
    9. Step-by-step derivation
      1. rec-expN/A

        \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
      2. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
      3. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
      4. --lowering--.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
      5. associate--l+N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
      9. unpow2N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
      11. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
      13. fabs-subN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
      14. sub-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
      15. mul-1-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
      16. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
      17. mul-1-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
      18. sub-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
      19. --lowering--.f6497.6%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    10. Simplified97.6%

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

    if -5.3999999999999995e-35 < m

    1. Initial program 72.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. Step-by-step derivation
      1. neg-sub0N/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
      2. associate--l-N/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
      3. exp-diffN/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      4. associate-*r/N/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      5. exp-0N/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
      6. *-rgt-identityN/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
    3. Simplified72.8%

      \[\leadsto \color{blue}{\frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\right)}}} \]
    4. Add Preprocessing
    5. Step-by-step derivation
      1. clear-numN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{\frac{2}{K \cdot \left(m + n\right)}}\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)}, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      2. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{2}{K \cdot \left(m + n\right)}\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)}, \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      3. *-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{2}{\left(m + n\right) \cdot K}\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      4. associate-/r*N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{\frac{2}{m + n}}{K}\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), \color{blue}{M}\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      5. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(\frac{2}{m + n}\right), K\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), \color{blue}{M}\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      6. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(2, \left(m + n\right)\right), K\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      7. +-lowering-+.f6471.8%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(2, \mathsf{+.f64}\left(m, n\right)\right), K\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Applied egg-rr71.8%

      \[\leadsto \frac{\cos \left(\color{blue}{\frac{1}{\frac{\frac{2}{m + n}}{K}}} - M\right)}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\right)}} \]
    7. Taylor expanded in l around inf

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{/.f64}\left(2, \mathsf{+.f64}\left(m, n\right)\right), K\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \color{blue}{\ell}\right)\right)\right) \]
    8. Step-by-step derivation
      1. Simplified71.5%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \color{blue}{\left(\frac{-2 \cdot \frac{n}{K \cdot m} + 2 \cdot \frac{1}{K}}{m}\right)}\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
      3. Step-by-step derivation
        1. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{2 \cdot \frac{1}{K} + -2 \cdot \frac{n}{K \cdot m}}{m}\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        2. metadata-evalN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{2 \cdot \frac{1}{K} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{n}{K \cdot m}}{m}\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        3. cancel-sign-sub-invN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \left(\frac{2 \cdot \frac{1}{K} - 2 \cdot \frac{n}{K \cdot m}}{m}\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        4. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(2 \cdot \frac{1}{K} - 2 \cdot \frac{n}{K \cdot m}\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), \color{blue}{M}\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        5. cancel-sign-sub-invN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(2 \cdot \frac{1}{K} + \left(\mathsf{neg}\left(2\right)\right) \cdot \frac{n}{K \cdot m}\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        6. metadata-evalN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(2 \cdot \frac{1}{K} + -2 \cdot \frac{n}{K \cdot m}\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        7. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\left(-2 \cdot \frac{n}{K \cdot m} + 2 \cdot \frac{1}{K}\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        8. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(-2 \cdot \frac{n}{K \cdot m}\right), \left(2 \cdot \frac{1}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        9. associate-*r/N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{-2 \cdot n}{K \cdot m}\right), \left(2 \cdot \frac{1}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        10. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{-2 \cdot n}{m \cdot K}\right), \left(2 \cdot \frac{1}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        11. associate-/r*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\left(\frac{\frac{-2 \cdot n}{m}}{K}\right), \left(2 \cdot \frac{1}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        12. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\left(\frac{-2 \cdot n}{m}\right), K\right), \left(2 \cdot \frac{1}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        13. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\left(-2 \cdot n\right), m\right), K\right), \left(2 \cdot \frac{1}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(-2, n\right), m\right), K\right), \left(2 \cdot \frac{1}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        15. associate-*r/N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(-2, n\right), m\right), K\right), \left(\frac{2 \cdot 1}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        16. metadata-evalN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(-2, n\right), m\right), K\right), \left(\frac{2}{K}\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
        17. /-lowering-/.f6486.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(1, \mathsf{/.f64}\left(\mathsf{+.f64}\left(\mathsf{/.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(-2, n\right), m\right), K\right), \mathsf{/.f64}\left(2, K\right)\right), m\right)\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right)\right)\right) \]
      4. Simplified86.2%

        \[\leadsto \frac{\cos \left(\frac{1}{\color{blue}{\frac{\frac{\frac{-2 \cdot n}{m}}{K} + \frac{2}{K}}{m}}} - M\right)}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \ell}} \]
    9. Recombined 2 regimes into one program.
    10. Final simplification89.7%

      \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -5.4 \cdot 10^{-35}:\\ \;\;\;\;e^{\left(\left|n - m\right| - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)\right) - \ell}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos \left(\frac{1}{\frac{\frac{\frac{n \cdot -2}{m}}{K} + \frac{2}{K}}{m}} - M\right)}{e^{\ell + \left(\frac{n + m}{2} - M\right) \cdot \left(\frac{n + m}{2} - M\right)}}\\ \end{array} \]
    11. Add Preprocessing

    Alternative 2: 96.8% accurate, 1.3× speedup?

    \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} t_0 := 0.5 \cdot \left(n + m\right) - M\\ \frac{\cos M}{e^{\left(\ell + t\_0 \cdot t\_0\right) - \left|n - m\right|}} \end{array} \end{array} \]
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    (FPCore (K m n M l)
     :precision binary64
     (let* ((t_0 (- (* 0.5 (+ n m)) M)))
       (/ (cos M) (exp (- (+ l (* t_0 t_0)) (fabs (- n m)))))))
    assert(K < m && m < n && n < M && M < l);
    double code(double K, double m, double n, double M, double l) {
    	double t_0 = (0.5 * (n + m)) - M;
    	return cos(M) / exp(((l + (t_0 * t_0)) - fabs((n - m))));
    }
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    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
        t_0 = (0.5d0 * (n + m)) - m_1
        code = cos(m_1) / exp(((l + (t_0 * t_0)) - abs((n - m))))
    end function
    
    assert K < m && m < n && n < M && M < l;
    public static double code(double K, double m, double n, double M, double l) {
    	double t_0 = (0.5 * (n + m)) - M;
    	return Math.cos(M) / Math.exp(((l + (t_0 * t_0)) - Math.abs((n - m))));
    }
    
    [K, m, n, M, l] = sort([K, m, n, M, l])
    def code(K, m, n, M, l):
    	t_0 = (0.5 * (n + m)) - M
    	return math.cos(M) / math.exp(((l + (t_0 * t_0)) - math.fabs((n - m))))
    
    K, m, n, M, l = sort([K, m, n, M, l])
    function code(K, m, n, M, l)
    	t_0 = Float64(Float64(0.5 * Float64(n + m)) - M)
    	return Float64(cos(M) / exp(Float64(Float64(l + Float64(t_0 * t_0)) - abs(Float64(n - m)))))
    end
    
    K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
    function tmp = code(K, m, n, M, l)
    	t_0 = (0.5 * (n + m)) - M;
    	tmp = cos(M) / exp(((l + (t_0 * t_0)) - abs((n - m))));
    end
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]}, N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(N[(l + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision] - N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
    
    \begin{array}{l}
    [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
    \\
    \begin{array}{l}
    t_0 := 0.5 \cdot \left(n + m\right) - M\\
    \frac{\cos M}{e^{\left(\ell + t\_0 \cdot t\_0\right) - \left|n - m\right|}}
    \end{array}
    \end{array}
    
    Derivation
    1. Initial program 72.5%

      \[\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. Step-by-step derivation
      1. neg-sub0N/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
      2. associate--l-N/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
      3. exp-diffN/A

        \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      4. associate-*r/N/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      5. exp-0N/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
      6. *-rgt-identityN/A

        \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
      7. /-lowering-/.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
    3. Simplified72.5%

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      6. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      7. unpow2N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      8. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      9. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      10. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      11. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      12. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      13. --lowering--.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      14. *-lowering-*.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      15. +-commutativeN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      16. +-lowering-+.f64N/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
      17. fabs-subN/A

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
    7. Simplified96.0%

      \[\leadsto \color{blue}{\frac{\cos M}{e^{\left(\ell + \left(0.5 \cdot \left(n + m\right) - M\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right)\right) - \left|n - m\right|}}} \]
    8. Add Preprocessing

    Alternative 3: 94.9% accurate, 1.9× speedup?

    \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} t_0 := \frac{\cos M}{e^{M \cdot M}}\\ \mathbf{if}\;M \leq -5.2 \cdot 10^{+17}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;M \leq 8.5 \cdot 10^{+76}:\\ \;\;\;\;e^{\left(\left|n - m\right| - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)\right) - \ell}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    (FPCore (K m n M l)
     :precision binary64
     (let* ((t_0 (/ (cos M) (exp (* M M)))))
       (if (<= M -5.2e+17)
         t_0
         (if (<= M 8.5e+76)
           (exp (- (- (fabs (- n m)) (* 0.25 (* (+ n m) (+ n m)))) l))
           t_0))))
    assert(K < m && m < n && n < M && M < l);
    double code(double K, double m, double n, double M, double l) {
    	double t_0 = cos(M) / exp((M * M));
    	double tmp;
    	if (M <= -5.2e+17) {
    		tmp = t_0;
    	} else if (M <= 8.5e+76) {
    		tmp = exp(((fabs((n - m)) - (0.25 * ((n + m) * (n + m)))) - l));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    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 = cos(m_1) / exp((m_1 * m_1))
        if (m_1 <= (-5.2d+17)) then
            tmp = t_0
        else if (m_1 <= 8.5d+76) then
            tmp = exp(((abs((n - m)) - (0.25d0 * ((n + m) * (n + m)))) - l))
        else
            tmp = t_0
        end if
        code = tmp
    end function
    
    assert K < m && m < n && n < M && M < l;
    public static double code(double K, double m, double n, double M, double l) {
    	double t_0 = Math.cos(M) / Math.exp((M * M));
    	double tmp;
    	if (M <= -5.2e+17) {
    		tmp = t_0;
    	} else if (M <= 8.5e+76) {
    		tmp = Math.exp(((Math.abs((n - m)) - (0.25 * ((n + m) * (n + m)))) - l));
    	} else {
    		tmp = t_0;
    	}
    	return tmp;
    }
    
    [K, m, n, M, l] = sort([K, m, n, M, l])
    def code(K, m, n, M, l):
    	t_0 = math.cos(M) / math.exp((M * M))
    	tmp = 0
    	if M <= -5.2e+17:
    		tmp = t_0
    	elif M <= 8.5e+76:
    		tmp = math.exp(((math.fabs((n - m)) - (0.25 * ((n + m) * (n + m)))) - l))
    	else:
    		tmp = t_0
    	return tmp
    
    K, m, n, M, l = sort([K, m, n, M, l])
    function code(K, m, n, M, l)
    	t_0 = Float64(cos(M) / exp(Float64(M * M)))
    	tmp = 0.0
    	if (M <= -5.2e+17)
    		tmp = t_0;
    	elseif (M <= 8.5e+76)
    		tmp = exp(Float64(Float64(abs(Float64(n - m)) - Float64(0.25 * Float64(Float64(n + m) * Float64(n + m)))) - l));
    	else
    		tmp = t_0;
    	end
    	return tmp
    end
    
    K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
    function tmp_2 = code(K, m, n, M, l)
    	t_0 = cos(M) / exp((M * M));
    	tmp = 0.0;
    	if (M <= -5.2e+17)
    		tmp = t_0;
    	elseif (M <= 8.5e+76)
    		tmp = exp(((abs((n - m)) - (0.25 * ((n + m) * (n + m)))) - l));
    	else
    		tmp = t_0;
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -5.2e+17], t$95$0, If[LessEqual[M, 8.5e+76], N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(0.25 * N[(N[(n + m), $MachinePrecision] * N[(n + m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision], t$95$0]]]
    
    \begin{array}{l}
    [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
    \\
    \begin{array}{l}
    t_0 := \frac{\cos M}{e^{M \cdot M}}\\
    \mathbf{if}\;M \leq -5.2 \cdot 10^{+17}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;M \leq 8.5 \cdot 10^{+76}:\\
    \;\;\;\;e^{\left(\left|n - m\right| - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)\right) - \ell}\\
    
    \mathbf{else}:\\
    \;\;\;\;t\_0\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if M < -5.2e17 or 8.49999999999999992e76 < M

      1. Initial program 77.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified77.3%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified100.0%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left({M}^{2}\right)}\right)\right) \]
      9. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(M \cdot M\right)\right)\right) \]
        2. *-lowering-*.f6497.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(M, M\right)\right)\right) \]
      10. Simplified97.3%

        \[\leadsto \frac{\cos M}{e^{\color{blue}{M \cdot M}}} \]

      if -5.2e17 < M < 8.49999999999999992e76

      1. Initial program 68.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified68.9%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified93.1%

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

        \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
        3. neg-sub0N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        5. associate--l+N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        13. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
        14. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
        16. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
        17. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
        18. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6493.7%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      10. Simplified93.7%

        \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
    3. Recombined 2 regimes into one program.
    4. Final simplification95.3%

      \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq -5.2 \cdot 10^{+17}:\\ \;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\ \mathbf{elif}\;M \leq 8.5 \cdot 10^{+76}:\\ \;\;\;\;e^{\left(\left|n - m\right| - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)\right) - \ell}\\ \mathbf{else}:\\ \;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 4: 86.7% accurate, 2.0× speedup?

    \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} \mathbf{if}\;m \leq -56:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\left|n - m\right| - \left(\ell + 0.25 \cdot \left(n \cdot n\right)\right)}\\ \end{array} \end{array} \]
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    (FPCore (K m n M l)
     :precision binary64
     (if (<= m -56.0)
       (exp (* -0.25 (* m m)))
       (exp (- (fabs (- n m)) (+ l (* 0.25 (* n n)))))))
    assert(K < m && m < n && n < M && M < l);
    double code(double K, double m, double n, double M, double l) {
    	double tmp;
    	if (m <= -56.0) {
    		tmp = exp((-0.25 * (m * m)));
    	} else {
    		tmp = exp((fabs((n - m)) - (l + (0.25 * (n * n)))));
    	}
    	return tmp;
    }
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    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) :: tmp
        if (m <= (-56.0d0)) then
            tmp = exp(((-0.25d0) * (m * m)))
        else
            tmp = exp((abs((n - m)) - (l + (0.25d0 * (n * n)))))
        end if
        code = tmp
    end function
    
    assert K < m && m < n && n < M && M < l;
    public static double code(double K, double m, double n, double M, double l) {
    	double tmp;
    	if (m <= -56.0) {
    		tmp = Math.exp((-0.25 * (m * m)));
    	} else {
    		tmp = Math.exp((Math.abs((n - m)) - (l + (0.25 * (n * n)))));
    	}
    	return tmp;
    }
    
    [K, m, n, M, l] = sort([K, m, n, M, l])
    def code(K, m, n, M, l):
    	tmp = 0
    	if m <= -56.0:
    		tmp = math.exp((-0.25 * (m * m)))
    	else:
    		tmp = math.exp((math.fabs((n - m)) - (l + (0.25 * (n * n)))))
    	return tmp
    
    K, m, n, M, l = sort([K, m, n, M, l])
    function code(K, m, n, M, l)
    	tmp = 0.0
    	if (m <= -56.0)
    		tmp = exp(Float64(-0.25 * Float64(m * m)));
    	else
    		tmp = exp(Float64(abs(Float64(n - m)) - Float64(l + Float64(0.25 * Float64(n * n)))));
    	end
    	return tmp
    end
    
    K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
    function tmp_2 = code(K, m, n, M, l)
    	tmp = 0.0;
    	if (m <= -56.0)
    		tmp = exp((-0.25 * (m * m)));
    	else
    		tmp = exp((abs((n - m)) - (l + (0.25 * (n * n)))));
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    code[K_, m_, n_, M_, l_] := If[LessEqual[m, -56.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(l + N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
    
    \begin{array}{l}
    [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;m \leq -56:\\
    \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{\left|n - m\right| - \left(\ell + 0.25 \cdot \left(n \cdot n\right)\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 2 regimes
    2. if m < -56

      1. Initial program 70.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified70.8%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified98.6%

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

        \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
        3. neg-sub0N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        5. associate--l+N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        13. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
        14. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
        16. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
        17. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
        18. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6498.6%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      10. Simplified98.6%

        \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
      11. Taylor expanded in m around inf

        \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {m}^{2}\right)}\right) \]
      12. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left({m}^{2}\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left(m \cdot m\right)\right)\right) \]
        3. *-lowering-*.f6497.3%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right) \]
      13. Simplified97.3%

        \[\leadsto e^{\color{blue}{-0.25 \cdot \left(m \cdot m\right)}} \]

      if -56 < m

      1. Initial program 73.2%

        \[\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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified73.2%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified95.0%

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

        \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
        3. neg-sub0N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        5. associate--l+N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        13. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
        14. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
        16. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
        17. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
        18. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6484.4%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      10. Simplified84.4%

        \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
      11. Taylor expanded in m around 0

        \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\left|m - n\right| - \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)}\right) \]
      12. Step-by-step derivation
        1. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)\right) \]
        2. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|n - m\right|\right), \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)\right) \]
        3. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + \left(\mathsf{neg}\left(m\right)\right)\right|\right), \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)\right) \]
        4. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + -1 \cdot m\right|\right), \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)\right) \]
        5. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + -1 \cdot m\right)\right), \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)\right) \]
        6. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + \left(\mathsf{neg}\left(m\right)\right)\right)\right), \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)\right) \]
        7. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n - m\right)\right), \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)\right) \]
        8. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \left(\ell + \frac{1}{4} \cdot {n}^{2}\right)\right)\right) \]
        9. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {n}^{2}\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{4}, \left({n}^{2}\right)\right)\right)\right)\right) \]
        11. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{4}, \left(n \cdot n\right)\right)\right)\right)\right) \]
        12. *-lowering-*.f6463.0%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right)\right) \]
      13. Simplified63.0%

        \[\leadsto e^{\color{blue}{\left|n - m\right| - \left(\ell + 0.25 \cdot \left(n \cdot n\right)\right)}} \]
    3. Recombined 2 regimes into one program.
    4. Add Preprocessing

    Alternative 5: 78.9% accurate, 2.0× speedup?

    \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} \mathbf{if}\;n \leq -1.4 \cdot 10^{-192}:\\ \;\;\;\;\frac{\cos M}{e^{m \cdot \left(m \cdot 0.25\right)}}\\ \mathbf{elif}\;n \leq 1.52 \cdot 10^{-74}:\\ \;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\ \mathbf{elif}\;n \leq 0.0005:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    (FPCore (K m n M l)
     :precision binary64
     (if (<= n -1.4e-192)
       (/ (cos M) (exp (* m (* m 0.25))))
       (if (<= n 1.52e-74)
         (/ (cos M) (exp (* M M)))
         (if (<= n 0.0005) (exp (* -0.25 (* m m))) (exp (* -0.25 (* n n)))))))
    assert(K < m && m < n && n < M && M < l);
    double code(double K, double m, double n, double M, double l) {
    	double tmp;
    	if (n <= -1.4e-192) {
    		tmp = cos(M) / exp((m * (m * 0.25)));
    	} else if (n <= 1.52e-74) {
    		tmp = cos(M) / exp((M * M));
    	} else if (n <= 0.0005) {
    		tmp = exp((-0.25 * (m * m)));
    	} else {
    		tmp = exp((-0.25 * (n * n)));
    	}
    	return tmp;
    }
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    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) :: tmp
        if (n <= (-1.4d-192)) then
            tmp = cos(m_1) / exp((m * (m * 0.25d0)))
        else if (n <= 1.52d-74) then
            tmp = cos(m_1) / exp((m_1 * m_1))
        else if (n <= 0.0005d0) then
            tmp = exp(((-0.25d0) * (m * m)))
        else
            tmp = exp(((-0.25d0) * (n * n)))
        end if
        code = tmp
    end function
    
    assert K < m && m < n && n < M && M < l;
    public static double code(double K, double m, double n, double M, double l) {
    	double tmp;
    	if (n <= -1.4e-192) {
    		tmp = Math.cos(M) / Math.exp((m * (m * 0.25)));
    	} else if (n <= 1.52e-74) {
    		tmp = Math.cos(M) / Math.exp((M * M));
    	} else if (n <= 0.0005) {
    		tmp = Math.exp((-0.25 * (m * m)));
    	} else {
    		tmp = Math.exp((-0.25 * (n * n)));
    	}
    	return tmp;
    }
    
    [K, m, n, M, l] = sort([K, m, n, M, l])
    def code(K, m, n, M, l):
    	tmp = 0
    	if n <= -1.4e-192:
    		tmp = math.cos(M) / math.exp((m * (m * 0.25)))
    	elif n <= 1.52e-74:
    		tmp = math.cos(M) / math.exp((M * M))
    	elif n <= 0.0005:
    		tmp = math.exp((-0.25 * (m * m)))
    	else:
    		tmp = math.exp((-0.25 * (n * n)))
    	return tmp
    
    K, m, n, M, l = sort([K, m, n, M, l])
    function code(K, m, n, M, l)
    	tmp = 0.0
    	if (n <= -1.4e-192)
    		tmp = Float64(cos(M) / exp(Float64(m * Float64(m * 0.25))));
    	elseif (n <= 1.52e-74)
    		tmp = Float64(cos(M) / exp(Float64(M * M)));
    	elseif (n <= 0.0005)
    		tmp = exp(Float64(-0.25 * Float64(m * m)));
    	else
    		tmp = exp(Float64(-0.25 * Float64(n * n)));
    	end
    	return tmp
    end
    
    K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
    function tmp_2 = code(K, m, n, M, l)
    	tmp = 0.0;
    	if (n <= -1.4e-192)
    		tmp = cos(M) / exp((m * (m * 0.25)));
    	elseif (n <= 1.52e-74)
    		tmp = cos(M) / exp((M * M));
    	elseif (n <= 0.0005)
    		tmp = exp((-0.25 * (m * m)));
    	else
    		tmp = exp((-0.25 * (n * n)));
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    code[K_, m_, n_, M_, l_] := If[LessEqual[n, -1.4e-192], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(m * N[(m * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.52e-74], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.0005], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
    
    \begin{array}{l}
    [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;n \leq -1.4 \cdot 10^{-192}:\\
    \;\;\;\;\frac{\cos M}{e^{m \cdot \left(m \cdot 0.25\right)}}\\
    
    \mathbf{elif}\;n \leq 1.52 \cdot 10^{-74}:\\
    \;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\
    
    \mathbf{elif}\;n \leq 0.0005:\\
    \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 4 regimes
    2. if n < -1.40000000000000002e-192

      1. Initial program 75.2%

        \[\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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified75.2%

        \[\leadsto \color{blue}{\frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\right)}}} \]
      4. Add Preprocessing
      5. Taylor expanded in m around inf

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\color{blue}{\left(\frac{1}{4} \cdot {m}^{2}\right)}\right)\right) \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\left({m}^{2} \cdot \frac{1}{4}\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\left(\left(m \cdot m\right) \cdot \frac{1}{4}\right)\right)\right) \]
        3. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\left(m \cdot \left(m \cdot \frac{1}{4}\right)\right)\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\left(m \cdot \left(\frac{1}{4} \cdot m\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \left(\frac{1}{4} \cdot m\right)\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \left(m \cdot \frac{1}{4}\right)\right)\right)\right) \]
        7. *-lowering-*.f6439.7%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \mathsf{*.f64}\left(m, \frac{1}{4}\right)\right)\right)\right) \]
      7. Simplified39.7%

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

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \mathsf{*.f64}\left(m, \frac{1}{4}\right)\right)\right)\right) \]
      9. Step-by-step derivation
        1. cos-negN/A

          \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{*.f64}\left(m, \mathsf{*.f64}\left(m, \frac{1}{4}\right)\right)}\right)\right) \]
        2. cos-lowering-cos.f6457.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{*.f64}\left(m, \mathsf{*.f64}\left(m, \frac{1}{4}\right)\right)}\right)\right) \]
      10. Simplified57.1%

        \[\leadsto \frac{\color{blue}{\cos M}}{e^{m \cdot \left(m \cdot 0.25\right)}} \]

      if -1.40000000000000002e-192 < n < 1.51999999999999997e-74

      1. Initial program 85.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified85.0%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified94.1%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left({M}^{2}\right)}\right)\right) \]
      9. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(M \cdot M\right)\right)\right) \]
        2. *-lowering-*.f6463.5%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(M, M\right)\right)\right) \]
      10. Simplified63.5%

        \[\leadsto \frac{\cos M}{e^{\color{blue}{M \cdot M}}} \]

      if 1.51999999999999997e-74 < n < 5.0000000000000001e-4

      1. Initial program 64.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified64.1%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified90.3%

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

        \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
        3. neg-sub0N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        5. associate--l+N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        13. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
        14. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
        16. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
        17. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
        18. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6490.3%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      10. Simplified90.3%

        \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
      11. Taylor expanded in m around inf

        \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {m}^{2}\right)}\right) \]
      12. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left({m}^{2}\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left(m \cdot m\right)\right)\right) \]
        3. *-lowering-*.f6478.2%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right) \]
      13. Simplified78.2%

        \[\leadsto e^{\color{blue}{-0.25 \cdot \left(m \cdot m\right)}} \]

      if 5.0000000000000001e-4 < n

      1. Initial program 52.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified52.7%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified98.3%

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

        \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
        3. neg-sub0N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        5. associate--l+N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        13. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
        14. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
        16. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
        17. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
        18. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6496.5%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      10. Simplified96.5%

        \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
      11. Taylor expanded in n around inf

        \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {n}^{2}\right)}\right) \]
      12. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{exp.f64}\left(\left({n}^{2} \cdot \frac{-1}{4}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left({n}^{2}\right), \frac{-1}{4}\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left(n \cdot n\right), \frac{-1}{4}\right)\right) \]
        4. *-lowering-*.f6496.5%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \frac{-1}{4}\right)\right) \]
      13. Simplified96.5%

        \[\leadsto e^{\color{blue}{\left(n \cdot n\right) \cdot -0.25}} \]
    3. Recombined 4 regimes into one program.
    4. Final simplification69.2%

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -1.4 \cdot 10^{-192}:\\ \;\;\;\;\frac{\cos M}{e^{m \cdot \left(m \cdot 0.25\right)}}\\ \mathbf{elif}\;n \leq 1.52 \cdot 10^{-74}:\\ \;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\ \mathbf{elif}\;n \leq 0.0005:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 6: 78.7% accurate, 2.0× speedup?

    \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} t_0 := e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{if}\;n \leq -5 \cdot 10^{-186}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 2 \cdot 10^{-79}:\\ \;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\ \mathbf{elif}\;n \leq 0.0005:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    (FPCore (K m n M l)
     :precision binary64
     (let* ((t_0 (exp (* -0.25 (* m m)))))
       (if (<= n -5e-186)
         t_0
         (if (<= n 2e-79)
           (/ (cos M) (exp (* M M)))
           (if (<= n 0.0005) t_0 (exp (* -0.25 (* n n))))))))
    assert(K < m && m < n && n < M && M < l);
    double code(double K, double m, double n, double M, double l) {
    	double t_0 = exp((-0.25 * (m * m)));
    	double tmp;
    	if (n <= -5e-186) {
    		tmp = t_0;
    	} else if (n <= 2e-79) {
    		tmp = cos(M) / exp((M * M));
    	} else if (n <= 0.0005) {
    		tmp = t_0;
    	} else {
    		tmp = exp((-0.25 * (n * n)));
    	}
    	return tmp;
    }
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    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 = exp(((-0.25d0) * (m * m)))
        if (n <= (-5d-186)) then
            tmp = t_0
        else if (n <= 2d-79) then
            tmp = cos(m_1) / exp((m_1 * m_1))
        else if (n <= 0.0005d0) then
            tmp = t_0
        else
            tmp = exp(((-0.25d0) * (n * n)))
        end if
        code = tmp
    end function
    
    assert K < m && m < n && n < M && M < l;
    public static double code(double K, double m, double n, double M, double l) {
    	double t_0 = Math.exp((-0.25 * (m * m)));
    	double tmp;
    	if (n <= -5e-186) {
    		tmp = t_0;
    	} else if (n <= 2e-79) {
    		tmp = Math.cos(M) / Math.exp((M * M));
    	} else if (n <= 0.0005) {
    		tmp = t_0;
    	} else {
    		tmp = Math.exp((-0.25 * (n * n)));
    	}
    	return tmp;
    }
    
    [K, m, n, M, l] = sort([K, m, n, M, l])
    def code(K, m, n, M, l):
    	t_0 = math.exp((-0.25 * (m * m)))
    	tmp = 0
    	if n <= -5e-186:
    		tmp = t_0
    	elif n <= 2e-79:
    		tmp = math.cos(M) / math.exp((M * M))
    	elif n <= 0.0005:
    		tmp = t_0
    	else:
    		tmp = math.exp((-0.25 * (n * n)))
    	return tmp
    
    K, m, n, M, l = sort([K, m, n, M, l])
    function code(K, m, n, M, l)
    	t_0 = exp(Float64(-0.25 * Float64(m * m)))
    	tmp = 0.0
    	if (n <= -5e-186)
    		tmp = t_0;
    	elseif (n <= 2e-79)
    		tmp = Float64(cos(M) / exp(Float64(M * M)));
    	elseif (n <= 0.0005)
    		tmp = t_0;
    	else
    		tmp = exp(Float64(-0.25 * Float64(n * n)));
    	end
    	return tmp
    end
    
    K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
    function tmp_2 = code(K, m, n, M, l)
    	t_0 = exp((-0.25 * (m * m)));
    	tmp = 0.0;
    	if (n <= -5e-186)
    		tmp = t_0;
    	elseif (n <= 2e-79)
    		tmp = cos(M) / exp((M * M));
    	elseif (n <= 0.0005)
    		tmp = t_0;
    	else
    		tmp = exp((-0.25 * (n * n)));
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -5e-186], t$95$0, If[LessEqual[n, 2e-79], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.0005], t$95$0, N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
    
    \begin{array}{l}
    [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
    \\
    \begin{array}{l}
    t_0 := e^{-0.25 \cdot \left(m \cdot m\right)}\\
    \mathbf{if}\;n \leq -5 \cdot 10^{-186}:\\
    \;\;\;\;t\_0\\
    
    \mathbf{elif}\;n \leq 2 \cdot 10^{-79}:\\
    \;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\
    
    \mathbf{elif}\;n \leq 0.0005:\\
    \;\;\;\;t\_0\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if n < -5e-186 or 2e-79 < n < 5.0000000000000001e-4

      1. Initial program 73.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified73.9%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified96.3%

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

        \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
        3. neg-sub0N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        5. associate--l+N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        13. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
        14. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
        16. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
        17. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
        18. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6492.2%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      10. Simplified92.2%

        \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
      11. Taylor expanded in m around inf

        \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {m}^{2}\right)}\right) \]
      12. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left({m}^{2}\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left(m \cdot m\right)\right)\right) \]
        3. *-lowering-*.f6460.2%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right) \]
      13. Simplified60.2%

        \[\leadsto e^{\color{blue}{-0.25 \cdot \left(m \cdot m\right)}} \]

      if -5e-186 < n < 2e-79

      1. Initial program 84.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified84.9%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified94.1%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left({M}^{2}\right)}\right)\right) \]
      9. Step-by-step derivation
        1. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(M \cdot M\right)\right)\right) \]
        2. *-lowering-*.f6463.0%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(M, M\right)\right)\right) \]
      10. Simplified63.0%

        \[\leadsto \frac{\cos M}{e^{\color{blue}{M \cdot M}}} \]

      if 5.0000000000000001e-4 < n

      1. Initial program 52.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified52.7%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified98.3%

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

        \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
        3. neg-sub0N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        5. associate--l+N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        13. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
        14. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
        16. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
        17. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
        18. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6496.5%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      10. Simplified96.5%

        \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
      11. Taylor expanded in n around inf

        \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {n}^{2}\right)}\right) \]
      12. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{exp.f64}\left(\left({n}^{2} \cdot \frac{-1}{4}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left({n}^{2}\right), \frac{-1}{4}\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left(n \cdot n\right), \frac{-1}{4}\right)\right) \]
        4. *-lowering-*.f6496.5%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \frac{-1}{4}\right)\right) \]
      13. Simplified96.5%

        \[\leadsto e^{\color{blue}{\left(n \cdot n\right) \cdot -0.25}} \]
    3. Recombined 3 regimes into one program.
    4. Final simplification69.1%

      \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -5 \cdot 10^{-186}:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;n \leq 2 \cdot 10^{-79}:\\ \;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\ \mathbf{elif}\;n \leq 0.0005:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \]
    5. Add Preprocessing

    Alternative 7: 77.1% accurate, 2.0× speedup?

    \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} \mathbf{if}\;m \leq -54:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -7.5 \cdot 10^{-88}:\\ \;\;\;\;\frac{\cos M}{e^{\ell}}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    (FPCore (K m n M l)
     :precision binary64
     (if (<= m -54.0)
       (exp (* -0.25 (* m m)))
       (if (<= m -7.5e-88) (/ (cos M) (exp l)) (exp (* -0.25 (* n n))))))
    assert(K < m && m < n && n < M && M < l);
    double code(double K, double m, double n, double M, double l) {
    	double tmp;
    	if (m <= -54.0) {
    		tmp = exp((-0.25 * (m * m)));
    	} else if (m <= -7.5e-88) {
    		tmp = cos(M) / exp(l);
    	} else {
    		tmp = exp((-0.25 * (n * n)));
    	}
    	return tmp;
    }
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    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) :: tmp
        if (m <= (-54.0d0)) then
            tmp = exp(((-0.25d0) * (m * m)))
        else if (m <= (-7.5d-88)) then
            tmp = cos(m_1) / exp(l)
        else
            tmp = exp(((-0.25d0) * (n * n)))
        end if
        code = tmp
    end function
    
    assert K < m && m < n && n < M && M < l;
    public static double code(double K, double m, double n, double M, double l) {
    	double tmp;
    	if (m <= -54.0) {
    		tmp = Math.exp((-0.25 * (m * m)));
    	} else if (m <= -7.5e-88) {
    		tmp = Math.cos(M) / Math.exp(l);
    	} else {
    		tmp = Math.exp((-0.25 * (n * n)));
    	}
    	return tmp;
    }
    
    [K, m, n, M, l] = sort([K, m, n, M, l])
    def code(K, m, n, M, l):
    	tmp = 0
    	if m <= -54.0:
    		tmp = math.exp((-0.25 * (m * m)))
    	elif m <= -7.5e-88:
    		tmp = math.cos(M) / math.exp(l)
    	else:
    		tmp = math.exp((-0.25 * (n * n)))
    	return tmp
    
    K, m, n, M, l = sort([K, m, n, M, l])
    function code(K, m, n, M, l)
    	tmp = 0.0
    	if (m <= -54.0)
    		tmp = exp(Float64(-0.25 * Float64(m * m)));
    	elseif (m <= -7.5e-88)
    		tmp = Float64(cos(M) / exp(l));
    	else
    		tmp = exp(Float64(-0.25 * Float64(n * n)));
    	end
    	return tmp
    end
    
    K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
    function tmp_2 = code(K, m, n, M, l)
    	tmp = 0.0;
    	if (m <= -54.0)
    		tmp = exp((-0.25 * (m * m)));
    	elseif (m <= -7.5e-88)
    		tmp = cos(M) / exp(l);
    	else
    		tmp = exp((-0.25 * (n * n)));
    	end
    	tmp_2 = tmp;
    end
    
    NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
    code[K_, m_, n_, M_, l_] := If[LessEqual[m, -54.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -7.5e-88], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
    
    \begin{array}{l}
    [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
    \\
    \begin{array}{l}
    \mathbf{if}\;m \leq -54:\\
    \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
    
    \mathbf{elif}\;m \leq -7.5 \cdot 10^{-88}:\\
    \;\;\;\;\frac{\cos M}{e^{\ell}}\\
    
    \mathbf{else}:\\
    \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
    
    
    \end{array}
    \end{array}
    
    Derivation
    1. Split input into 3 regimes
    2. if m < -54

      1. Initial program 70.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified70.8%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified98.6%

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

        \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
      9. Step-by-step derivation
        1. rec-expN/A

          \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
        2. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
        3. neg-sub0N/A

          \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        4. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
        5. associate--l+N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
        7. --lowering--.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        9. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        11. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
        13. fabs-subN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
        14. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
        15. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
        16. fabs-lowering-fabs.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
        17. mul-1-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
        18. sub-negN/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
        19. --lowering--.f6498.6%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      10. Simplified98.6%

        \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
      11. Taylor expanded in m around inf

        \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {m}^{2}\right)}\right) \]
      12. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left({m}^{2}\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left(m \cdot m\right)\right)\right) \]
        3. *-lowering-*.f6497.3%

          \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right) \]
      13. Simplified97.3%

        \[\leadsto e^{\color{blue}{-0.25 \cdot \left(m \cdot m\right)}} \]

      if -54 < m < -7.50000000000000041e-88

      1. Initial program 86.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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified86.6%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified89.0%

        \[\leadsto \color{blue}{\frac{\cos M}{e^{\left(\ell + \left(0.5 \cdot \left(n + m\right) - M\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right)\right) - \left|n - m\right|}}} \]
      8. Taylor expanded in l around inf

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\ell}\right)\right) \]
      9. Step-by-step derivation
        1. Simplified56.5%

          \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]

        if -7.50000000000000041e-88 < m

        1. Initial program 72.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. Step-by-step derivation
          1. neg-sub0N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
          2. associate--l-N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
          3. exp-diffN/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          5. exp-0N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
          6. *-rgt-identityN/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
        3. Simplified72.0%

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
          5. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          13. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          15. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          16. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          17. fabs-subN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
        7. Simplified95.6%

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

          \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
        9. Step-by-step derivation
          1. rec-expN/A

            \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
          2. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
          3. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          5. associate--l+N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          11. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          13. fabs-subN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
          14. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
          15. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
          16. fabs-lowering-fabs.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
          17. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
          18. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6484.6%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
        10. Simplified84.6%

          \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
        11. Taylor expanded in n around inf

          \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {n}^{2}\right)}\right) \]
        12. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{exp.f64}\left(\left({n}^{2} \cdot \frac{-1}{4}\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left({n}^{2}\right), \frac{-1}{4}\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left(n \cdot n\right), \frac{-1}{4}\right)\right) \]
          4. *-lowering-*.f6452.6%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \frac{-1}{4}\right)\right) \]
        13. Simplified52.6%

          \[\leadsto e^{\color{blue}{\left(n \cdot n\right) \cdot -0.25}} \]
      10. Recombined 3 regimes into one program.
      11. Final simplification65.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -54:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -7.5 \cdot 10^{-88}:\\ \;\;\;\;\frac{\cos M}{e^{\ell}}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \]
      12. Add Preprocessing

      Alternative 8: 70.2% accurate, 3.8× speedup?

      \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} \mathbf{if}\;m \leq -54:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -2.25 \cdot 10^{-261}:\\ \;\;\;\;e^{0 - \ell}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1}\\ \end{array} \end{array} \]
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      (FPCore (K m n M l)
       :precision binary64
       (if (<= m -54.0)
         (exp (* -0.25 (* m m)))
         (if (<= m -2.25e-261)
           (exp (- 0.0 l))
           (/
            (+ (* (* M M) -0.5) 1.0)
            (+
             (*
              (* n n)
              (+ 0.25 (* n (* n (+ 0.03125 (* (* n n) 0.0026041666666666665))))))
             1.0)))))
      assert(K < m && m < n && n < M && M < l);
      double code(double K, double m, double n, double M, double l) {
      	double tmp;
      	if (m <= -54.0) {
      		tmp = exp((-0.25 * (m * m)));
      	} else if (m <= -2.25e-261) {
      		tmp = exp((0.0 - l));
      	} else {
      		tmp = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      	}
      	return tmp;
      }
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      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) :: tmp
          if (m <= (-54.0d0)) then
              tmp = exp(((-0.25d0) * (m * m)))
          else if (m <= (-2.25d-261)) then
              tmp = exp((0.0d0 - l))
          else
              tmp = (((m_1 * m_1) * (-0.5d0)) + 1.0d0) / (((n * n) * (0.25d0 + (n * (n * (0.03125d0 + ((n * n) * 0.0026041666666666665d0)))))) + 1.0d0)
          end if
          code = tmp
      end function
      
      assert K < m && m < n && n < M && M < l;
      public static double code(double K, double m, double n, double M, double l) {
      	double tmp;
      	if (m <= -54.0) {
      		tmp = Math.exp((-0.25 * (m * m)));
      	} else if (m <= -2.25e-261) {
      		tmp = Math.exp((0.0 - l));
      	} else {
      		tmp = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      	}
      	return tmp;
      }
      
      [K, m, n, M, l] = sort([K, m, n, M, l])
      def code(K, m, n, M, l):
      	tmp = 0
      	if m <= -54.0:
      		tmp = math.exp((-0.25 * (m * m)))
      	elif m <= -2.25e-261:
      		tmp = math.exp((0.0 - l))
      	else:
      		tmp = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0)
      	return tmp
      
      K, m, n, M, l = sort([K, m, n, M, l])
      function code(K, m, n, M, l)
      	tmp = 0.0
      	if (m <= -54.0)
      		tmp = exp(Float64(-0.25 * Float64(m * m)));
      	elseif (m <= -2.25e-261)
      		tmp = exp(Float64(0.0 - l));
      	else
      		tmp = Float64(Float64(Float64(Float64(M * M) * -0.5) + 1.0) / Float64(Float64(Float64(n * n) * Float64(0.25 + Float64(n * Float64(n * Float64(0.03125 + Float64(Float64(n * n) * 0.0026041666666666665)))))) + 1.0));
      	end
      	return tmp
      end
      
      K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
      function tmp_2 = code(K, m, n, M, l)
      	tmp = 0.0;
      	if (m <= -54.0)
      		tmp = exp((-0.25 * (m * m)));
      	elseif (m <= -2.25e-261)
      		tmp = exp((0.0 - l));
      	else
      		tmp = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      code[K_, m_, n_, M_, l_] := If[LessEqual[m, -54.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -2.25e-261], N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision], N[(N[(N[(N[(M * M), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(N[(n * n), $MachinePrecision] * N[(0.25 + N[(n * N[(n * N[(0.03125 + N[(N[(n * n), $MachinePrecision] * 0.0026041666666666665), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]]]
      
      \begin{array}{l}
      [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;m \leq -54:\\
      \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
      
      \mathbf{elif}\;m \leq -2.25 \cdot 10^{-261}:\\
      \;\;\;\;e^{0 - \ell}\\
      
      \mathbf{else}:\\
      \;\;\;\;\frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 3 regimes
      2. if m < -54

        1. Initial program 70.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. Step-by-step derivation
          1. neg-sub0N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
          2. associate--l-N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
          3. exp-diffN/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          5. exp-0N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
          6. *-rgt-identityN/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
        3. Simplified70.8%

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
          5. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          13. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          15. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          16. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          17. fabs-subN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
        7. Simplified98.6%

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

          \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
        9. Step-by-step derivation
          1. rec-expN/A

            \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
          2. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
          3. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          5. associate--l+N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          11. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          13. fabs-subN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
          14. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
          15. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
          16. fabs-lowering-fabs.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
          17. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
          18. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6498.6%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
        10. Simplified98.6%

          \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
        11. Taylor expanded in m around inf

          \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {m}^{2}\right)}\right) \]
        12. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left({m}^{2}\right)\right)\right) \]
          2. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left(m \cdot m\right)\right)\right) \]
          3. *-lowering-*.f6497.3%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right) \]
        13. Simplified97.3%

          \[\leadsto e^{\color{blue}{-0.25 \cdot \left(m \cdot m\right)}} \]

        if -54 < m < -2.25e-261

        1. Initial program 73.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. Step-by-step derivation
          1. neg-sub0N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
          2. associate--l-N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
          3. exp-diffN/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          5. exp-0N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
          6. *-rgt-identityN/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
        3. Simplified73.9%

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
          5. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          13. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          15. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          16. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          17. fabs-subN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
        7. Simplified89.2%

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

          \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
        9. Step-by-step derivation
          1. rec-expN/A

            \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
          2. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
          3. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          5. associate--l+N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          11. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          13. fabs-subN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
          14. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
          15. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
          16. fabs-lowering-fabs.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
          17. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
          18. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6482.6%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
        10. Simplified82.6%

          \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
        11. Taylor expanded in l around inf

          \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \ell\right)}\right) \]
        12. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right) \]
          2. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \ell\right)\right) \]
          3. --lowering--.f6449.7%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right) \]
        13. Simplified49.7%

          \[\leadsto e^{\color{blue}{0 - \ell}} \]

        if -2.25e-261 < m

        1. Initial program 72.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. Step-by-step derivation
          1. neg-sub0N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
          2. associate--l-N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
          3. exp-diffN/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          5. exp-0N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
          6. *-rgt-identityN/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
        3. Simplified72.8%

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
          5. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          13. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          15. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          16. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          17. fabs-subN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
        7. Simplified97.8%

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left(\frac{1}{4} \cdot {n}^{2}\right)}\right)\right) \]
        9. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({n}^{2}\right)\right)\right)\right) \]
          2. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(n \cdot n\right)\right)\right)\right) \]
          3. *-lowering-*.f6451.3%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
        10. Simplified51.3%

          \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(n \cdot n\right)}}} \]
        11. Taylor expanded in M around 0

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {M}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
        12. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {M}^{2}\right)\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)}\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({M}^{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\mathsf{*.f64}\left(n, n\right)}\right)\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(M \cdot M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
          4. *-lowering-*.f6439.8%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
        13. Simplified39.8%

          \[\leadsto \frac{\color{blue}{1 + -0.5 \cdot \left(M \cdot M\right)}}{e^{0.25 \cdot \left(n \cdot n\right)}} \]
        14. Taylor expanded in n around 0

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \color{blue}{\left(1 + {n}^{2} \cdot \left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)}\right) \]
        15. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left({n}^{2} \cdot \left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)}\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({n}^{2}\right), \color{blue}{\left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(n \cdot n\right), \left(\color{blue}{\frac{1}{4}} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \left(\color{blue}{\frac{1}{4}} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right) \]
          5. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \color{blue}{\left({n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right) \]
          6. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(\left(n \cdot n\right) \cdot \left(\color{blue}{\frac{1}{32}} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right)\right) \]
          7. associate-*l*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(n \cdot \color{blue}{\left(n \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{\left(n \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \color{blue}{\left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
          10. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \color{blue}{\left(\frac{1}{384} \cdot {n}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \left({n}^{2} \cdot \color{blue}{\frac{1}{384}}\right)\right)\right)\right)\right)\right)\right)\right) \]
          12. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\left({n}^{2}\right), \color{blue}{\frac{1}{384}}\right)\right)\right)\right)\right)\right)\right)\right) \]
          13. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\left(n \cdot n\right), \frac{1}{384}\right)\right)\right)\right)\right)\right)\right)\right) \]
          14. *-lowering-*.f6438.3%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \frac{1}{384}\right)\right)\right)\right)\right)\right)\right)\right) \]
        16. Simplified38.3%

          \[\leadsto \frac{1 + -0.5 \cdot \left(M \cdot M\right)}{\color{blue}{1 + \left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right)}} \]
      3. Recombined 3 regimes into one program.
      4. Final simplification57.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -54:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -2.25 \cdot 10^{-261}:\\ \;\;\;\;e^{0 - \ell}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 9: 54.7% accurate, 3.8× speedup?

      \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} t_0 := \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1}\\ \mathbf{if}\;n \leq -350:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;n \leq 6.4 \cdot 10^{+51}:\\ \;\;\;\;e^{0 - \ell}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      (FPCore (K m n M l)
       :precision binary64
       (let* ((t_0
               (/
                (+ (* (* M M) -0.5) 1.0)
                (+
                 (*
                  (* n n)
                  (+ 0.25 (* n (* n (+ 0.03125 (* (* n n) 0.0026041666666666665))))))
                 1.0))))
         (if (<= n -350.0) t_0 (if (<= n 6.4e+51) (exp (- 0.0 l)) t_0))))
      assert(K < m && m < n && n < M && M < l);
      double code(double K, double m, double n, double M, double l) {
      	double t_0 = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      	double tmp;
      	if (n <= -350.0) {
      		tmp = t_0;
      	} else if (n <= 6.4e+51) {
      		tmp = exp((0.0 - l));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      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 = (((m_1 * m_1) * (-0.5d0)) + 1.0d0) / (((n * n) * (0.25d0 + (n * (n * (0.03125d0 + ((n * n) * 0.0026041666666666665d0)))))) + 1.0d0)
          if (n <= (-350.0d0)) then
              tmp = t_0
          else if (n <= 6.4d+51) then
              tmp = exp((0.0d0 - l))
          else
              tmp = t_0
          end if
          code = tmp
      end function
      
      assert K < m && m < n && n < M && M < l;
      public static double code(double K, double m, double n, double M, double l) {
      	double t_0 = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      	double tmp;
      	if (n <= -350.0) {
      		tmp = t_0;
      	} else if (n <= 6.4e+51) {
      		tmp = Math.exp((0.0 - l));
      	} else {
      		tmp = t_0;
      	}
      	return tmp;
      }
      
      [K, m, n, M, l] = sort([K, m, n, M, l])
      def code(K, m, n, M, l):
      	t_0 = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0)
      	tmp = 0
      	if n <= -350.0:
      		tmp = t_0
      	elif n <= 6.4e+51:
      		tmp = math.exp((0.0 - l))
      	else:
      		tmp = t_0
      	return tmp
      
      K, m, n, M, l = sort([K, m, n, M, l])
      function code(K, m, n, M, l)
      	t_0 = Float64(Float64(Float64(Float64(M * M) * -0.5) + 1.0) / Float64(Float64(Float64(n * n) * Float64(0.25 + Float64(n * Float64(n * Float64(0.03125 + Float64(Float64(n * n) * 0.0026041666666666665)))))) + 1.0))
      	tmp = 0.0
      	if (n <= -350.0)
      		tmp = t_0;
      	elseif (n <= 6.4e+51)
      		tmp = exp(Float64(0.0 - l));
      	else
      		tmp = t_0;
      	end
      	return tmp
      end
      
      K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
      function tmp_2 = code(K, m, n, M, l)
      	t_0 = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      	tmp = 0.0;
      	if (n <= -350.0)
      		tmp = t_0;
      	elseif (n <= 6.4e+51)
      		tmp = exp((0.0 - l));
      	else
      		tmp = t_0;
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(N[(N[(M * M), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(N[(n * n), $MachinePrecision] * N[(0.25 + N[(n * N[(n * N[(0.03125 + N[(N[(n * n), $MachinePrecision] * 0.0026041666666666665), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -350.0], t$95$0, If[LessEqual[n, 6.4e+51], N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision], t$95$0]]]
      
      \begin{array}{l}
      [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
      \\
      \begin{array}{l}
      t_0 := \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1}\\
      \mathbf{if}\;n \leq -350:\\
      \;\;\;\;t\_0\\
      
      \mathbf{elif}\;n \leq 6.4 \cdot 10^{+51}:\\
      \;\;\;\;e^{0 - \ell}\\
      
      \mathbf{else}:\\
      \;\;\;\;t\_0\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if n < -350 or 6.4000000000000005e51 < n

        1. Initial program 61.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. Step-by-step derivation
          1. neg-sub0N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
          2. associate--l-N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
          3. exp-diffN/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          5. exp-0N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
          6. *-rgt-identityN/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
        3. Simplified61.7%

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
          5. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          13. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          15. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          16. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          17. fabs-subN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
        7. Simplified99.1%

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left(\frac{1}{4} \cdot {n}^{2}\right)}\right)\right) \]
        9. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({n}^{2}\right)\right)\right)\right) \]
          2. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(n \cdot n\right)\right)\right)\right) \]
          3. *-lowering-*.f6498.3%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
        10. Simplified98.3%

          \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(n \cdot n\right)}}} \]
        11. Taylor expanded in M around 0

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {M}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
        12. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {M}^{2}\right)\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)}\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({M}^{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\mathsf{*.f64}\left(n, n\right)}\right)\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(M \cdot M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
          4. *-lowering-*.f6475.7%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
        13. Simplified75.7%

          \[\leadsto \frac{\color{blue}{1 + -0.5 \cdot \left(M \cdot M\right)}}{e^{0.25 \cdot \left(n \cdot n\right)}} \]
        14. Taylor expanded in n around 0

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \color{blue}{\left(1 + {n}^{2} \cdot \left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)}\right) \]
        15. Step-by-step derivation
          1. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left({n}^{2} \cdot \left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)}\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({n}^{2}\right), \color{blue}{\left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(n \cdot n\right), \left(\color{blue}{\frac{1}{4}} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right) \]
          4. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \left(\color{blue}{\frac{1}{4}} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right) \]
          5. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \color{blue}{\left({n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right) \]
          6. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(\left(n \cdot n\right) \cdot \left(\color{blue}{\frac{1}{32}} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right)\right) \]
          7. associate-*l*N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(n \cdot \color{blue}{\left(n \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{\left(n \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
          9. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \color{blue}{\left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
          10. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \color{blue}{\left(\frac{1}{384} \cdot {n}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
          11. *-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \left({n}^{2} \cdot \color{blue}{\frac{1}{384}}\right)\right)\right)\right)\right)\right)\right)\right) \]
          12. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\left({n}^{2}\right), \color{blue}{\frac{1}{384}}\right)\right)\right)\right)\right)\right)\right)\right) \]
          13. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\left(n \cdot n\right), \frac{1}{384}\right)\right)\right)\right)\right)\right)\right)\right) \]
          14. *-lowering-*.f6472.5%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \frac{1}{384}\right)\right)\right)\right)\right)\right)\right)\right) \]
        16. Simplified72.5%

          \[\leadsto \frac{1 + -0.5 \cdot \left(M \cdot M\right)}{\color{blue}{1 + \left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right)}} \]

        if -350 < n < 6.4000000000000005e51

        1. Initial program 81.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. Step-by-step derivation
          1. neg-sub0N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
          2. associate--l-N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
          3. exp-diffN/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          5. exp-0N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
          6. *-rgt-identityN/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
        3. Simplified81.3%

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
          5. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          13. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          15. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          16. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          17. fabs-subN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
        7. Simplified93.5%

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

          \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
        9. Step-by-step derivation
          1. rec-expN/A

            \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
          2. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
          3. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          5. associate--l+N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          11. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          13. fabs-subN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
          14. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
          15. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
          16. fabs-lowering-fabs.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
          17. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
          18. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6480.4%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
        10. Simplified80.4%

          \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
        11. Taylor expanded in l around inf

          \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \ell\right)}\right) \]
        12. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right) \]
          2. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \ell\right)\right) \]
          3. --lowering--.f6446.3%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right) \]
        13. Simplified46.3%

          \[\leadsto e^{\color{blue}{0 - \ell}} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification58.0%

        \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq -350:\\ \;\;\;\;\frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1}\\ \mathbf{elif}\;n \leq 6.4 \cdot 10^{+51}:\\ \;\;\;\;e^{0 - \ell}\\ \mathbf{else}:\\ \;\;\;\;\frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 10: 77.4% accurate, 3.9× speedup?

      \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \begin{array}{l} \mathbf{if}\;m \leq -0.0031:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      (FPCore (K m n M l)
       :precision binary64
       (if (<= m -0.0031) (exp (* -0.25 (* m m))) (exp (* -0.25 (* n n)))))
      assert(K < m && m < n && n < M && M < l);
      double code(double K, double m, double n, double M, double l) {
      	double tmp;
      	if (m <= -0.0031) {
      		tmp = exp((-0.25 * (m * m)));
      	} else {
      		tmp = exp((-0.25 * (n * n)));
      	}
      	return tmp;
      }
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      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) :: tmp
          if (m <= (-0.0031d0)) then
              tmp = exp(((-0.25d0) * (m * m)))
          else
              tmp = exp(((-0.25d0) * (n * n)))
          end if
          code = tmp
      end function
      
      assert K < m && m < n && n < M && M < l;
      public static double code(double K, double m, double n, double M, double l) {
      	double tmp;
      	if (m <= -0.0031) {
      		tmp = Math.exp((-0.25 * (m * m)));
      	} else {
      		tmp = Math.exp((-0.25 * (n * n)));
      	}
      	return tmp;
      }
      
      [K, m, n, M, l] = sort([K, m, n, M, l])
      def code(K, m, n, M, l):
      	tmp = 0
      	if m <= -0.0031:
      		tmp = math.exp((-0.25 * (m * m)))
      	else:
      		tmp = math.exp((-0.25 * (n * n)))
      	return tmp
      
      K, m, n, M, l = sort([K, m, n, M, l])
      function code(K, m, n, M, l)
      	tmp = 0.0
      	if (m <= -0.0031)
      		tmp = exp(Float64(-0.25 * Float64(m * m)));
      	else
      		tmp = exp(Float64(-0.25 * Float64(n * n)));
      	end
      	return tmp
      end
      
      K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
      function tmp_2 = code(K, m, n, M, l)
      	tmp = 0.0;
      	if (m <= -0.0031)
      		tmp = exp((-0.25 * (m * m)));
      	else
      		tmp = exp((-0.25 * (n * n)));
      	end
      	tmp_2 = tmp;
      end
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.0031], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
      
      \begin{array}{l}
      [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
      \\
      \begin{array}{l}
      \mathbf{if}\;m \leq -0.0031:\\
      \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
      
      \mathbf{else}:\\
      \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
      
      
      \end{array}
      \end{array}
      
      Derivation
      1. Split input into 2 regimes
      2. if m < -0.00309999999999999989

        1. Initial program 70.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. Step-by-step derivation
          1. neg-sub0N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
          2. associate--l-N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
          3. exp-diffN/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          5. exp-0N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
          6. *-rgt-identityN/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
        3. Simplified70.3%

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
          5. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          13. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          15. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          16. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          17. fabs-subN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
        7. Simplified97.5%

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

          \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
        9. Step-by-step derivation
          1. rec-expN/A

            \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
          2. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
          3. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          5. associate--l+N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          11. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          13. fabs-subN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
          14. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
          15. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
          16. fabs-lowering-fabs.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
          17. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
          18. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6497.5%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
        10. Simplified97.5%

          \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
        11. Taylor expanded in m around inf

          \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {m}^{2}\right)}\right) \]
        12. Step-by-step derivation
          1. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left({m}^{2}\right)\right)\right) \]
          2. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left(m \cdot m\right)\right)\right) \]
          3. *-lowering-*.f6494.9%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right) \]
        13. Simplified94.9%

          \[\leadsto e^{\color{blue}{-0.25 \cdot \left(m \cdot m\right)}} \]

        if -0.00309999999999999989 < 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. Step-by-step derivation
          1. neg-sub0N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
          2. associate--l-N/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
          3. exp-diffN/A

            \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          4. associate-*r/N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          5. exp-0N/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
          6. *-rgt-identityN/A

            \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
          7. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
        3. Simplified73.4%

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
          4. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
          5. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          7. unpow2N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          9. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          11. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          13. --lowering--.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          14. *-lowering-*.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          15. +-commutativeN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          16. +-lowering-+.f64N/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
          17. fabs-subN/A

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
        7. Simplified95.4%

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

          \[\leadsto \color{blue}{\frac{1}{e^{\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|}}} \]
        9. Step-by-step derivation
          1. rec-expN/A

            \[\leadsto e^{\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)} \]
          2. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right)\right) \]
          3. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          4. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right) - \left|n - m\right|\right)\right)\right) \]
          5. associate--l+N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(\ell + \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          6. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \left(\frac{1}{4} \cdot {\left(m + n\right)}^{2} - \left|n - m\right|\right)\right)\right)\right) \]
          7. --lowering--.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          8. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({\left(m + n\right)}^{2}\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          11. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \left(m + n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          12. +-lowering-+.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right)\right) \]
          13. fabs-subN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right)\right) \]
          14. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right)\right)\right)\right)\right) \]
          15. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \left(\left|m + -1 \cdot n\right|\right)\right)\right)\right)\right) \]
          16. fabs-lowering-fabs.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right)\right)\right)\right)\right) \]
          17. mul-1-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right)\right)\right)\right)\right) \]
          18. sub-negN/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\left(m - n\right)\right)\right)\right)\right)\right) \]
          19. --lowering--.f6484.7%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{+.f64}\left(\ell, \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
        10. Simplified84.7%

          \[\leadsto \color{blue}{e^{0 - \left(\ell + \left(0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right) - \left|m - n\right|\right)\right)}} \]
        11. Taylor expanded in n around inf

          \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {n}^{2}\right)}\right) \]
        12. Step-by-step derivation
          1. *-commutativeN/A

            \[\leadsto \mathsf{exp.f64}\left(\left({n}^{2} \cdot \frac{-1}{4}\right)\right) \]
          2. *-lowering-*.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left({n}^{2}\right), \frac{-1}{4}\right)\right) \]
          3. unpow2N/A

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left(n \cdot n\right), \frac{-1}{4}\right)\right) \]
          4. *-lowering-*.f6453.4%

            \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \frac{-1}{4}\right)\right) \]
        13. Simplified53.4%

          \[\leadsto e^{\color{blue}{\left(n \cdot n\right) \cdot -0.25}} \]
      3. Recombined 2 regimes into one program.
      4. Final simplification65.4%

        \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -0.0031:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \]
      5. Add Preprocessing

      Alternative 11: 36.5% accurate, 15.7× speedup?

      \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1} \end{array} \]
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      (FPCore (K m n M l)
       :precision binary64
       (/
        (+ (* (* M M) -0.5) 1.0)
        (+
         (*
          (* n n)
          (+ 0.25 (* n (* n (+ 0.03125 (* (* n n) 0.0026041666666666665))))))
         1.0)))
      assert(K < m && m < n && n < M && M < l);
      double code(double K, double m, double n, double M, double l) {
      	return (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      }
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      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 = (((m_1 * m_1) * (-0.5d0)) + 1.0d0) / (((n * n) * (0.25d0 + (n * (n * (0.03125d0 + ((n * n) * 0.0026041666666666665d0)))))) + 1.0d0)
      end function
      
      assert K < m && m < n && n < M && M < l;
      public static double code(double K, double m, double n, double M, double l) {
      	return (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      }
      
      [K, m, n, M, l] = sort([K, m, n, M, l])
      def code(K, m, n, M, l):
      	return (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0)
      
      K, m, n, M, l = sort([K, m, n, M, l])
      function code(K, m, n, M, l)
      	return Float64(Float64(Float64(Float64(M * M) * -0.5) + 1.0) / Float64(Float64(Float64(n * n) * Float64(0.25 + Float64(n * Float64(n * Float64(0.03125 + Float64(Float64(n * n) * 0.0026041666666666665)))))) + 1.0))
      end
      
      K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
      function tmp = code(K, m, n, M, l)
      	tmp = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + (n * (n * (0.03125 + ((n * n) * 0.0026041666666666665)))))) + 1.0);
      end
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      code[K_, m_, n_, M_, l_] := N[(N[(N[(N[(M * M), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(N[(n * n), $MachinePrecision] * N[(0.25 + N[(n * N[(n * N[(0.03125 + N[(N[(n * n), $MachinePrecision] * 0.0026041666666666665), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
      \\
      \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1}
      \end{array}
      
      Derivation
      1. Initial program 72.5%

        \[\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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified72.5%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified96.0%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left(\frac{1}{4} \cdot {n}^{2}\right)}\right)\right) \]
      9. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({n}^{2}\right)\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(n \cdot n\right)\right)\right)\right) \]
        3. *-lowering-*.f6452.5%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
      10. Simplified52.5%

        \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(n \cdot n\right)}}} \]
      11. Taylor expanded in M around 0

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {M}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {M}^{2}\right)\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({M}^{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\mathsf{*.f64}\left(n, n\right)}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(M \cdot M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
        4. *-lowering-*.f6441.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
      13. Simplified41.3%

        \[\leadsto \frac{\color{blue}{1 + -0.5 \cdot \left(M \cdot M\right)}}{e^{0.25 \cdot \left(n \cdot n\right)}} \]
      14. Taylor expanded in n around 0

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \color{blue}{\left(1 + {n}^{2} \cdot \left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)}\right) \]
      15. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left({n}^{2} \cdot \left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({n}^{2}\right), \color{blue}{\left(\frac{1}{4} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(n \cdot n\right), \left(\color{blue}{\frac{1}{4}} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \left(\color{blue}{\frac{1}{4}} + {n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right) \]
        5. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \color{blue}{\left({n}^{2} \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right) \]
        6. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(\left(n \cdot n\right) \cdot \left(\color{blue}{\frac{1}{32}} + \frac{1}{384} \cdot {n}^{2}\right)\right)\right)\right)\right)\right) \]
        7. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \left(n \cdot \color{blue}{\left(n \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{\left(n \cdot \left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)\right)}\right)\right)\right)\right)\right) \]
        9. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \color{blue}{\left(\frac{1}{32} + \frac{1}{384} \cdot {n}^{2}\right)}\right)\right)\right)\right)\right)\right) \]
        10. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \color{blue}{\left(\frac{1}{384} \cdot {n}^{2}\right)}\right)\right)\right)\right)\right)\right)\right) \]
        11. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \left({n}^{2} \cdot \color{blue}{\frac{1}{384}}\right)\right)\right)\right)\right)\right)\right)\right) \]
        12. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\left({n}^{2}\right), \color{blue}{\frac{1}{384}}\right)\right)\right)\right)\right)\right)\right)\right) \]
        13. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\left(n \cdot n\right), \frac{1}{384}\right)\right)\right)\right)\right)\right)\right)\right) \]
        14. *-lowering-*.f6439.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \mathsf{*.f64}\left(n, \mathsf{+.f64}\left(\frac{1}{32}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \frac{1}{384}\right)\right)\right)\right)\right)\right)\right)\right) \]
      16. Simplified39.1%

        \[\leadsto \frac{1 + -0.5 \cdot \left(M \cdot M\right)}{\color{blue}{1 + \left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right)}} \]
      17. Final simplification39.1%

        \[\leadsto \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + n \cdot \left(n \cdot \left(0.03125 + \left(n \cdot n\right) \cdot 0.0026041666666666665\right)\right)\right) + 1} \]
      18. Add Preprocessing

      Alternative 12: 33.6% accurate, 20.2× speedup?

      \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + \left(n \cdot n\right) \cdot 0.03125\right) + 1} \end{array} \]
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      (FPCore (K m n M l)
       :precision binary64
       (/ (+ (* (* M M) -0.5) 1.0) (+ (* (* n n) (+ 0.25 (* (* n n) 0.03125))) 1.0)))
      assert(K < m && m < n && n < M && M < l);
      double code(double K, double m, double n, double M, double l) {
      	return (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + ((n * n) * 0.03125))) + 1.0);
      }
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      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 = (((m_1 * m_1) * (-0.5d0)) + 1.0d0) / (((n * n) * (0.25d0 + ((n * n) * 0.03125d0))) + 1.0d0)
      end function
      
      assert K < m && m < n && n < M && M < l;
      public static double code(double K, double m, double n, double M, double l) {
      	return (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + ((n * n) * 0.03125))) + 1.0);
      }
      
      [K, m, n, M, l] = sort([K, m, n, M, l])
      def code(K, m, n, M, l):
      	return (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + ((n * n) * 0.03125))) + 1.0)
      
      K, m, n, M, l = sort([K, m, n, M, l])
      function code(K, m, n, M, l)
      	return Float64(Float64(Float64(Float64(M * M) * -0.5) + 1.0) / Float64(Float64(Float64(n * n) * Float64(0.25 + Float64(Float64(n * n) * 0.03125))) + 1.0))
      end
      
      K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
      function tmp = code(K, m, n, M, l)
      	tmp = (((M * M) * -0.5) + 1.0) / (((n * n) * (0.25 + ((n * n) * 0.03125))) + 1.0);
      end
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      code[K_, m_, n_, M_, l_] := N[(N[(N[(N[(M * M), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(N[(n * n), $MachinePrecision] * N[(0.25 + N[(N[(n * n), $MachinePrecision] * 0.03125), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
      \\
      \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + \left(n \cdot n\right) \cdot 0.03125\right) + 1}
      \end{array}
      
      Derivation
      1. Initial program 72.5%

        \[\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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified72.5%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified96.0%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left(\frac{1}{4} \cdot {n}^{2}\right)}\right)\right) \]
      9. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({n}^{2}\right)\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(n \cdot n\right)\right)\right)\right) \]
        3. *-lowering-*.f6452.5%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
      10. Simplified52.5%

        \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(n \cdot n\right)}}} \]
      11. Taylor expanded in M around 0

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {M}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {M}^{2}\right)\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({M}^{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\mathsf{*.f64}\left(n, n\right)}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(M \cdot M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
        4. *-lowering-*.f6441.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
      13. Simplified41.3%

        \[\leadsto \frac{\color{blue}{1 + -0.5 \cdot \left(M \cdot M\right)}}{e^{0.25 \cdot \left(n \cdot n\right)}} \]
      14. Taylor expanded in n around 0

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \color{blue}{\left(1 + {n}^{2} \cdot \left(\frac{1}{4} + \frac{1}{32} \cdot {n}^{2}\right)\right)}\right) \]
      15. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left({n}^{2} \cdot \left(\frac{1}{4} + \frac{1}{32} \cdot {n}^{2}\right)\right)}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({n}^{2}\right), \color{blue}{\left(\frac{1}{4} + \frac{1}{32} \cdot {n}^{2}\right)}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left(n \cdot n\right), \left(\color{blue}{\frac{1}{4}} + \frac{1}{32} \cdot {n}^{2}\right)\right)\right)\right) \]
        4. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \left(\color{blue}{\frac{1}{4}} + \frac{1}{32} \cdot {n}^{2}\right)\right)\right)\right) \]
        5. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \color{blue}{\left(\frac{1}{32} \cdot {n}^{2}\right)}\right)\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \left({n}^{2} \cdot \color{blue}{\frac{1}{32}}\right)\right)\right)\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left({n}^{2}\right), \color{blue}{\frac{1}{32}}\right)\right)\right)\right)\right) \]
        8. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\left(n \cdot n\right), \frac{1}{32}\right)\right)\right)\right)\right) \]
        9. *-lowering-*.f6435.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \mathsf{+.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(n, n\right), \frac{1}{32}\right)\right)\right)\right)\right) \]
      16. Simplified35.1%

        \[\leadsto \frac{1 + -0.5 \cdot \left(M \cdot M\right)}{\color{blue}{1 + \left(n \cdot n\right) \cdot \left(0.25 + \left(n \cdot n\right) \cdot 0.03125\right)}} \]
      17. Final simplification35.1%

        \[\leadsto \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{\left(n \cdot n\right) \cdot \left(0.25 + \left(n \cdot n\right) \cdot 0.03125\right) + 1} \]
      18. Add Preprocessing

      Alternative 13: 25.2% accurate, 28.3× speedup?

      \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{0.25 \cdot \left(n \cdot n\right) + 1} \end{array} \]
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      (FPCore (K m n M l)
       :precision binary64
       (/ (+ (* (* M M) -0.5) 1.0) (+ (* 0.25 (* n n)) 1.0)))
      assert(K < m && m < n && n < M && M < l);
      double code(double K, double m, double n, double M, double l) {
      	return (((M * M) * -0.5) + 1.0) / ((0.25 * (n * n)) + 1.0);
      }
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      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 = (((m_1 * m_1) * (-0.5d0)) + 1.0d0) / ((0.25d0 * (n * n)) + 1.0d0)
      end function
      
      assert K < m && m < n && n < M && M < l;
      public static double code(double K, double m, double n, double M, double l) {
      	return (((M * M) * -0.5) + 1.0) / ((0.25 * (n * n)) + 1.0);
      }
      
      [K, m, n, M, l] = sort([K, m, n, M, l])
      def code(K, m, n, M, l):
      	return (((M * M) * -0.5) + 1.0) / ((0.25 * (n * n)) + 1.0)
      
      K, m, n, M, l = sort([K, m, n, M, l])
      function code(K, m, n, M, l)
      	return Float64(Float64(Float64(Float64(M * M) * -0.5) + 1.0) / Float64(Float64(0.25 * Float64(n * n)) + 1.0))
      end
      
      K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
      function tmp = code(K, m, n, M, l)
      	tmp = (((M * M) * -0.5) + 1.0) / ((0.25 * (n * n)) + 1.0);
      end
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      code[K_, m_, n_, M_, l_] := N[(N[(N[(N[(M * M), $MachinePrecision] * -0.5), $MachinePrecision] + 1.0), $MachinePrecision] / N[(N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision] + 1.0), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
      \\
      \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{0.25 \cdot \left(n \cdot n\right) + 1}
      \end{array}
      
      Derivation
      1. Initial program 72.5%

        \[\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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified72.5%

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|}}\right)\right) \]
        4. exp-lowering-exp.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right) - \left|m - n\right|\right)\right)\right) \]
        5. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        6. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        7. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        8. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        9. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        10. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        11. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        12. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        13. --lowering--.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        14. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(m + n\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        15. +-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n + m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        16. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|m - n\right|\right)\right)\right)\right) \]
        17. fabs-subN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\ell, \mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{+.f64}\left(n, m\right)\right), M\right)\right)\right), \left(\left|n - m\right|\right)\right)\right)\right) \]
      7. Simplified96.0%

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left(\frac{1}{4} \cdot {n}^{2}\right)}\right)\right) \]
      9. Step-by-step derivation
        1. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({n}^{2}\right)\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left(n \cdot n\right)\right)\right)\right) \]
        3. *-lowering-*.f6452.5%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
      10. Simplified52.5%

        \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(n \cdot n\right)}}} \]
      11. Taylor expanded in M around 0

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\left(1 + \frac{-1}{2} \cdot {M}^{2}\right)}, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right)\right) \]
      12. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \left(\frac{-1}{2} \cdot {M}^{2}\right)\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, n\right)\right)}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left({M}^{2}\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\mathsf{*.f64}\left(n, n\right)}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \left(M \cdot M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
        4. *-lowering-*.f6441.3%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
      13. Simplified41.3%

        \[\leadsto \frac{\color{blue}{1 + -0.5 \cdot \left(M \cdot M\right)}}{e^{0.25 \cdot \left(n \cdot n\right)}} \]
      14. Taylor expanded in n around 0

        \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \color{blue}{\left(1 + \frac{1}{4} \cdot {n}^{2}\right)}\right) \]
      15. Step-by-step derivation
        1. +-lowering-+.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{4} \cdot {n}^{2}\right)}\right)\right) \]
        2. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \color{blue}{\left({n}^{2}\right)}\right)\right)\right) \]
        3. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \left(n \cdot \color{blue}{n}\right)\right)\right)\right) \]
        4. *-lowering-*.f6426.1%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(M, M\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{4}, \mathsf{*.f64}\left(n, \color{blue}{n}\right)\right)\right)\right) \]
      16. Simplified26.1%

        \[\leadsto \frac{1 + -0.5 \cdot \left(M \cdot M\right)}{\color{blue}{1 + 0.25 \cdot \left(n \cdot n\right)}} \]
      17. Final simplification26.1%

        \[\leadsto \frac{\left(M \cdot M\right) \cdot -0.5 + 1}{0.25 \cdot \left(n \cdot n\right) + 1} \]
      18. Add Preprocessing

      Alternative 14: 6.9% accurate, 425.0× speedup?

      \[\begin{array}{l} [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\ \\ 1 \end{array} \]
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      (FPCore (K m n M l) :precision binary64 1.0)
      assert(K < m && m < n && n < M && M < l);
      double code(double K, double m, double n, double M, double l) {
      	return 1.0;
      }
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      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 = 1.0d0
      end function
      
      assert K < m && m < n && n < M && M < l;
      public static double code(double K, double m, double n, double M, double l) {
      	return 1.0;
      }
      
      [K, m, n, M, l] = sort([K, m, n, M, l])
      def code(K, m, n, M, l):
      	return 1.0
      
      K, m, n, M, l = sort([K, m, n, M, l])
      function code(K, m, n, M, l)
      	return 1.0
      end
      
      K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
      function tmp = code(K, m, n, M, l)
      	tmp = 1.0;
      end
      
      NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
      code[K_, m_, n_, M_, l_] := 1.0
      
      \begin{array}{l}
      [K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
      \\
      1
      \end{array}
      
      Derivation
      1. Initial program 72.5%

        \[\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. Step-by-step derivation
        1. neg-sub0N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(0 - {\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
        2. associate--l-N/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0 - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)\right)} \]
        3. exp-diffN/A

          \[\leadsto \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \frac{e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        4. associate-*r/N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{0}}{\color{blue}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        5. exp-0N/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot 1}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \color{blue}{\left(\ell - \left|m - n\right|\right)}}} \]
        6. *-rgt-identityN/A

          \[\leadsto \frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\color{blue}{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}} \]
        7. /-lowering-/.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right), \color{blue}{\left(e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}\right)}\right) \]
      3. Simplified72.5%

        \[\leadsto \color{blue}{\frac{\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\right)}}} \]
      4. Add Preprocessing
      5. Taylor expanded in m around inf

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\color{blue}{\left(\frac{1}{4} \cdot {m}^{2}\right)}\right)\right) \]
      6. Step-by-step derivation
        1. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\left({m}^{2} \cdot \frac{1}{4}\right)\right)\right) \]
        2. unpow2N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\left(\left(m \cdot m\right) \cdot \frac{1}{4}\right)\right)\right) \]
        3. associate-*l*N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\left(m \cdot \left(m \cdot \frac{1}{4}\right)\right)\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\left(m \cdot \left(\frac{1}{4} \cdot m\right)\right)\right)\right) \]
        5. *-lowering-*.f64N/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \left(\frac{1}{4} \cdot m\right)\right)\right)\right) \]
        6. *-commutativeN/A

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \left(m \cdot \frac{1}{4}\right)\right)\right)\right) \]
        7. *-lowering-*.f6440.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), 2\right), M\right)\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \mathsf{*.f64}\left(m, \frac{1}{4}\right)\right)\right)\right) \]
      7. Simplified40.2%

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

        \[\leadsto \color{blue}{\cos \left(\frac{1}{2} \cdot \left(K \cdot n\right) - M\right)} \]
      9. Step-by-step derivation
        1. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{cos.f64}\left(\left(\frac{1}{2} \cdot \left(K \cdot n\right) - M\right)\right) \]
        2. --lowering--.f64N/A

          \[\leadsto \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\left(\frac{1}{2} \cdot \left(K \cdot n\right)\right), M\right)\right) \]
        3. *-lowering-*.f64N/A

          \[\leadsto \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(K \cdot n\right)\right), M\right)\right) \]
        4. *-commutativeN/A

          \[\leadsto \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n \cdot K\right)\right), M\right)\right) \]
        5. *-lowering-*.f647.8%

          \[\leadsto \mathsf{cos.f64}\left(\mathsf{\_.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right), M\right)\right) \]
      10. Simplified7.8%

        \[\leadsto \color{blue}{\cos \left(0.5 \cdot \left(n \cdot K\right) - M\right)} \]
      11. Taylor expanded in n around 0

        \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)} \]
      12. Step-by-step derivation
        1. cos-negN/A

          \[\leadsto \cos M \]
        2. cos-lowering-cos.f648.3%

          \[\leadsto \mathsf{cos.f64}\left(M\right) \]
      13. Simplified8.3%

        \[\leadsto \color{blue}{\cos M} \]
      14. Taylor expanded in M around 0

        \[\leadsto \color{blue}{1} \]
      15. Step-by-step derivation
        1. Simplified8.2%

          \[\leadsto \color{blue}{1} \]
        2. Add Preprocessing

        Reproduce

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