Maksimov and Kolovsky, Equation (32)

Percentage Accurate: 76.6% → 96.4%
Time: 14.2s
Alternatives: 11
Speedup: 1.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 11 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.6% accurate, 1.0× speedup?

\[\begin{array}{l} \\ \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (*
  (cos (- (/ (* K (+ m n)) 2.0) M))
  (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
	return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8), intent (in) :: n
    real(8), intent (in) :: m_1
    real(8), intent (in) :: l
    code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
	return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l):
	return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l)
	return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n))))))
end
function tmp = code(K, m, n, M, l)
	tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n)))));
end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}

\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}

Alternative 1: 96.4% accurate, 1.9× speedup?

\[\begin{array}{l} \\ e^{\left|n - m\right| + \left(\left(M + -0.5 \cdot \left(n + m\right)\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right) - \ell\right)} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (exp
  (+ (fabs (- n m)) (- (* (+ M (* -0.5 (+ n m))) (- (* 0.5 (+ n m)) M)) l))))
double code(double K, double m, double n, double M, double l) {
	return exp((fabs((n - m)) + (((M + (-0.5 * (n + m))) * ((0.5 * (n + m)) - M)) - l)));
}
real(8) function code(k, m, n, m_1, l)
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8), intent (in) :: n
    real(8), intent (in) :: m_1
    real(8), intent (in) :: l
    code = exp((abs((n - m)) + (((m_1 + ((-0.5d0) * (n + m))) * ((0.5d0 * (n + m)) - m_1)) - l)))
end function
public static double code(double K, double m, double n, double M, double l) {
	return Math.exp((Math.abs((n - m)) + (((M + (-0.5 * (n + m))) * ((0.5 * (n + m)) - M)) - l)));
}
def code(K, m, n, M, l):
	return math.exp((math.fabs((n - m)) + (((M + (-0.5 * (n + m))) * ((0.5 * (n + m)) - M)) - l)))
function code(K, m, n, M, l)
	return exp(Float64(abs(Float64(n - m)) + Float64(Float64(Float64(M + Float64(-0.5 * Float64(n + m))) * Float64(Float64(0.5 * Float64(n + m)) - M)) - l)))
end
function tmp = code(K, m, n, M, l)
	tmp = exp((abs((n - m)) + (((M + (-0.5 * (n + m))) * ((0.5 * (n + m)) - M)) - l)));
end
code[K_, m_, n_, M_, l_] := N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(M + N[(-0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * N[(N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}

\\
e^{\left|n - m\right| + \left(\left(M + -0.5 \cdot \left(n + m\right)\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right) - \ell\right)}
\end{array}
Derivation
  1. Initial program 77.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
    14. +-lowering-+.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
    15. metadata-evalN/A

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

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
  3. Simplified77.5%

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

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

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

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

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

    \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
  9. Step-by-step derivation
    1. Simplified97.7%

      \[\leadsto e^{\left|n - m\right| + \left(\left(M + -0.5 \cdot \left(m + n\right)\right) \cdot \left(\left(m + n\right) \cdot 0.5 - M\right) - \ell\right)} \cdot \color{blue}{1} \]
    2. Final simplification97.7%

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

    Alternative 2: 92.5% accurate, 1.9× speedup?

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

      1. Initial program 86.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
        14. +-lowering-+.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
        15. metadata-evalN/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
      3. Simplified86.0%

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
      7. Simplified100.0%

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
      9. Step-by-step derivation
        1. Simplified100.0%

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot {M}^{2}\right)}\right), 1\right) \]
        3. Step-by-step derivation
          1. mul-1-negN/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(\mathsf{neg}\left({M}^{2}\right)\right)\right), 1\right) \]
          2. neg-sub0N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(0 - {M}^{2}\right)\right), 1\right) \]
          3. --lowering--.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left({M}^{2}\right)\right)\right), 1\right) \]
          4. unpow2N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(M \cdot M\right)\right)\right), 1\right) \]
          5. *-lowering-*.f64100.0%

            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(M, M\right)\right)\right), 1\right) \]
        4. Simplified100.0%

          \[\leadsto e^{\color{blue}{0 - M \cdot M}} \cdot 1 \]
        5. Step-by-step derivation
          1. *-rgt-identityN/A

            \[\leadsto e^{0 - M \cdot M} \]
          2. exp-diffN/A

            \[\leadsto \frac{e^{0}}{\color{blue}{e^{M \cdot M}}} \]
          3. 1-expN/A

            \[\leadsto \frac{1}{e^{\color{blue}{M \cdot M}}} \]
          4. /-lowering-/.f64N/A

            \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(e^{M \cdot M}\right)}\right) \]
          5. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\left(M \cdot M\right)\right)\right) \]
          6. *-lowering-*.f64100.0%

            \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(M, M\right)\right)\right) \]
        6. Applied egg-rr100.0%

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

        if -2.70000000000000013e32 < M < 27

        1. Initial program 74.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
          14. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
          15. metadata-evalN/A

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
        3. Simplified74.6%

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
        7. Simplified95.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        if 27 < M

        1. Initial program 77.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
          14. +-lowering-+.f64N/A

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
          15. metadata-evalN/A

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

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

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

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

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

            \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
        7. Simplified98.6%

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
        9. Step-by-step derivation
          1. Simplified100.0%

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

            \[\leadsto \color{blue}{e^{\left(\left|n - m\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell}} \]
          3. Step-by-step derivation
            1. associate--l+N/A

              \[\leadsto e^{\left|n - m\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
            2. fabs-subN/A

              \[\leadsto e^{\left|m - n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
            3. sub-negN/A

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

              \[\leadsto e^{\left|m + -1 \cdot n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
            5. fabs-negN/A

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

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

              \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell\right)\right) \]
            8. associate--l+N/A

              \[\leadsto \mathsf{exp.f64}\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
            9. fabs-negN/A

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

              \[\leadsto \mathsf{exp.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
            11. sub-negN/A

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

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

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right|\right), \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
          4. Simplified91.6%

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

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

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

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), \left(\frac{m}{M} - 1\right)\right)\right) \]
            3. *-lowering-*.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \left(\frac{m}{M} - 1\right)\right)\right) \]
            4. sub-negN/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \left(\frac{m}{M} + \left(\mathsf{neg}\left(1\right)\right)\right)\right)\right) \]
            5. metadata-evalN/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \left(\frac{m}{M} + -1\right)\right)\right) \]
            6. +-commutativeN/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \left(-1 + \frac{m}{M}\right)\right)\right) \]
            7. +-lowering-+.f64N/A

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(-1, \left(\frac{m}{M}\right)\right)\right)\right) \]
            8. /-lowering-/.f6483.1%

              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(-1, \mathsf{/.f64}\left(m, M\right)\right)\right)\right) \]
          7. Simplified83.1%

            \[\leadsto e^{\color{blue}{\left(M \cdot M\right) \cdot \left(-1 + \frac{m}{M}\right)}} \]
        10. Recombined 3 regimes into one program.
        11. Final simplification93.0%

          \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq -2.7 \cdot 10^{+32}:\\ \;\;\;\;\frac{1}{e^{M \cdot M}}\\ \mathbf{elif}\;M \leq 27:\\ \;\;\;\;e^{\left|n - m\right| + \left(-0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right) - \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{\left(M \cdot M\right) \cdot \left(-1 + \frac{m}{M}\right)}\\ \end{array} \]
        12. Add Preprocessing

        Alternative 3: 87.8% accurate, 1.9× speedup?

        \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq 15500000000000:\\ \;\;\;\;e^{\left|n - m\right| + \left(\left(M + m \cdot -0.5\right) \cdot \left(m \cdot 0.5 - M\right) - \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\ \end{array} \end{array} \]
        (FPCore (K m n M l)
         :precision binary64
         (if (<= n 15500000000000.0)
           (exp (+ (fabs (- n m)) (- (* (+ M (* m -0.5)) (- (* m 0.5) M)) l)))
           (exp (* n (* n -0.25)))))
        double code(double K, double m, double n, double M, double l) {
        	double tmp;
        	if (n <= 15500000000000.0) {
        		tmp = exp((fabs((n - m)) + (((M + (m * -0.5)) * ((m * 0.5) - M)) - l)));
        	} else {
        		tmp = exp((n * (n * -0.25)));
        	}
        	return tmp;
        }
        
        real(8) function code(k, m, n, m_1, l)
            real(8), intent (in) :: k
            real(8), intent (in) :: m
            real(8), intent (in) :: n
            real(8), intent (in) :: m_1
            real(8), intent (in) :: l
            real(8) :: tmp
            if (n <= 15500000000000.0d0) then
                tmp = exp((abs((n - m)) + (((m_1 + (m * (-0.5d0))) * ((m * 0.5d0) - m_1)) - l)))
            else
                tmp = exp((n * (n * (-0.25d0))))
            end if
            code = tmp
        end function
        
        public static double code(double K, double m, double n, double M, double l) {
        	double tmp;
        	if (n <= 15500000000000.0) {
        		tmp = Math.exp((Math.abs((n - m)) + (((M + (m * -0.5)) * ((m * 0.5) - M)) - l)));
        	} else {
        		tmp = Math.exp((n * (n * -0.25)));
        	}
        	return tmp;
        }
        
        def code(K, m, n, M, l):
        	tmp = 0
        	if n <= 15500000000000.0:
        		tmp = math.exp((math.fabs((n - m)) + (((M + (m * -0.5)) * ((m * 0.5) - M)) - l)))
        	else:
        		tmp = math.exp((n * (n * -0.25)))
        	return tmp
        
        function code(K, m, n, M, l)
        	tmp = 0.0
        	if (n <= 15500000000000.0)
        		tmp = exp(Float64(abs(Float64(n - m)) + Float64(Float64(Float64(M + Float64(m * -0.5)) * Float64(Float64(m * 0.5) - M)) - l)));
        	else
        		tmp = exp(Float64(n * Float64(n * -0.25)));
        	end
        	return tmp
        end
        
        function tmp_2 = code(K, m, n, M, l)
        	tmp = 0.0;
        	if (n <= 15500000000000.0)
        		tmp = exp((abs((n - m)) + (((M + (m * -0.5)) * ((m * 0.5) - M)) - l)));
        	else
        		tmp = exp((n * (n * -0.25)));
        	end
        	tmp_2 = tmp;
        end
        
        code[K_, m_, n_, M_, l_] := If[LessEqual[n, 15500000000000.0], N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(M + N[(m * -0.5), $MachinePrecision]), $MachinePrecision] * N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
        
        \begin{array}{l}
        
        \\
        \begin{array}{l}
        \mathbf{if}\;n \leq 15500000000000:\\
        \;\;\;\;e^{\left|n - m\right| + \left(\left(M + m \cdot -0.5\right) \cdot \left(m \cdot 0.5 - M\right) - \ell\right)}\\
        
        \mathbf{else}:\\
        \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
        
        
        \end{array}
        \end{array}
        
        Derivation
        1. Split input into 2 regimes
        2. if n < 1.55e13

          1. Initial program 77.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
            14. +-lowering-+.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
            15. metadata-evalN/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
          3. Simplified77.0%

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
          7. Simplified96.6%

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

            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
          9. Step-by-step derivation
            1. Simplified97.1%

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

              \[\leadsto \color{blue}{e^{\left(\left|n - m\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell}} \]
            3. Step-by-step derivation
              1. associate--l+N/A

                \[\leadsto e^{\left|n - m\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
              2. fabs-subN/A

                \[\leadsto e^{\left|m - n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
              3. sub-negN/A

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

                \[\leadsto e^{\left|m + -1 \cdot n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
              5. fabs-negN/A

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

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

                \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell\right)\right) \]
              8. associate--l+N/A

                \[\leadsto \mathsf{exp.f64}\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
              9. fabs-negN/A

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

                \[\leadsto \mathsf{exp.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
              11. sub-negN/A

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

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

                \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right|\right), \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
            4. Simplified87.2%

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

            if 1.55e13 < n

            1. Initial program 79.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
              14. +-lowering-+.f64N/A

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
              15. metadata-evalN/A

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
            3. Simplified79.2%

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

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

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

                \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
            7. Simplified100.0%

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
            9. Step-by-step derivation
              1. Simplified100.0%

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(n \cdot \left(n \cdot \frac{-1}{4}\right)\right)\right), 1\right) \]
                4. *-commutativeN/A

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(n, \left(\frac{-1}{4} \cdot n\right)\right)\right), 1\right) \]
                6. *-commutativeN/A

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

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

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

              \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 15500000000000:\\ \;\;\;\;e^{\left|n - m\right| + \left(\left(M + m \cdot -0.5\right) \cdot \left(m \cdot 0.5 - M\right) - \ell\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\ \end{array} \]
            12. Add Preprocessing

            Alternative 4: 72.4% accurate, 1.9× speedup?

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

              1. Initial program 76.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                14. +-lowering-+.f64N/A

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                15. metadata-evalN/A

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
              3. Simplified76.8%

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
              7. Simplified96.5%

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

                \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
              9. Step-by-step derivation
                1. Simplified97.0%

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

                  \[\leadsto \color{blue}{e^{\left(\left|n - m\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell}} \]
                3. Step-by-step derivation
                  1. associate--l+N/A

                    \[\leadsto e^{\left|n - m\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                  2. fabs-subN/A

                    \[\leadsto e^{\left|m - n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                  3. sub-negN/A

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

                    \[\leadsto e^{\left|m + -1 \cdot n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                  5. fabs-negN/A

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

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

                    \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell\right)\right) \]
                  8. associate--l+N/A

                    \[\leadsto \mathsf{exp.f64}\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                  9. fabs-negN/A

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

                    \[\leadsto \mathsf{exp.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                  11. sub-negN/A

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

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

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right|\right), \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                4. Simplified87.0%

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

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

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

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

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

                    \[\leadsto \mathsf{exp.f64}\left(\left(\left|m - n\right| + \left(\left(M \cdot m + \left(\frac{-1}{4} \cdot m\right) \cdot m\right) - \ell\right)\right)\right) \]
                  5. distribute-rgt-inN/A

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

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

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

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

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n + -1 \cdot m\right|\right), \left(m \cdot \left(M + \frac{-1}{4} \cdot m\right) - \ell\right)\right)\right) \]
                  10. 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(m \cdot \left(M + \frac{-1}{4} \cdot m\right) - \ell\right)\right)\right) \]
                  11. 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(m \cdot \left(M + \frac{-1}{4} \cdot m\right) - \ell\right)\right)\right) \]
                  12. sub-negN/A

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

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \left(m \cdot \left(M + \frac{-1}{4} \cdot m\right) - \ell\right)\right)\right) \]
                  14. --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(\left(m \cdot \left(M + \frac{-1}{4} \cdot m\right)\right), \ell\right)\right)\right) \]
                  15. *-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(\mathsf{*.f64}\left(m, \left(M + \frac{-1}{4} \cdot m\right)\right), \ell\right)\right)\right) \]
                  16. +-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(\mathsf{*.f64}\left(m, \mathsf{+.f64}\left(M, \left(\frac{-1}{4} \cdot m\right)\right)\right), \ell\right)\right)\right) \]
                  17. *-commutativeN/A

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

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

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

                if 6.99999999999999993e-4 < n

                1. Initial program 80.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                  14. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                  15. metadata-evalN/A

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                3. Simplified80.0%

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
                7. Simplified100.0%

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

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

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

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

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

                  \[\leadsto e^{\color{blue}{-0.25 \cdot \left(n \cdot n\right)}} \cdot \cos M \]
              10. Recombined 2 regimes into one program.
              11. Add Preprocessing

              Alternative 5: 62.2% accurate, 2.0× speedup?

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

                1. Initial program 76.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                  14. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                  15. metadata-evalN/A

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                3. Simplified76.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(K, m\right)\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right)\right)\right) \]
                10. Simplified43.9%

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(m, \left(\frac{-1}{2} \cdot K\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\color{blue}{\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right)}, \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right)\right)\right) \]
                  7. *-lowering-*.f6443.9%

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(m, \mathsf{*.f64}\left(\frac{-1}{2}, K\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right)\right)\right) \]
                13. Simplified43.9%

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

                  \[\leadsto \color{blue}{e^{\left|n - m\right| + \frac{-1}{4} \cdot {m}^{2}}} \]
                15. Step-by-step derivation
                  1. exp-sumN/A

                    \[\leadsto e^{\left|n - m\right|} \cdot \color{blue}{e^{\frac{-1}{4} \cdot {m}^{2}}} \]
                  2. fabs-subN/A

                    \[\leadsto e^{\left|m - n\right|} \cdot e^{\color{blue}{\frac{-1}{4}} \cdot {m}^{2}} \]
                  3. prod-expN/A

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

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

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

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

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

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n + -1 \cdot m\right|\right), \left(\frac{-1}{4} \cdot {m}^{2}\right)\right)\right) \]
                  9. 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(\frac{-1}{4} \cdot {m}^{2}\right)\right)\right) \]
                  10. 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(\frac{-1}{4} \cdot {m}^{2}\right)\right)\right) \]
                  11. sub-negN/A

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

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

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

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

                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \left(m \cdot \left(\frac{-1}{4} \cdot m\right)\right)\right)\right) \]
                  16. *-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(m, \left(\frac{-1}{4} \cdot m\right)\right)\right)\right) \]
                  17. *-commutativeN/A

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

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

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

                if 1e-142 < n < 1.3e13

                1. Initial program 78.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                  14. +-lowering-+.f64N/A

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                  15. metadata-evalN/A

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                3. Simplified78.0%

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

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

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

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

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

                  \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                9. Step-by-step derivation
                  1. Simplified91.7%

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot {M}^{2}\right)}\right), 1\right) \]
                  3. Step-by-step derivation
                    1. mul-1-negN/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(\mathsf{neg}\left({M}^{2}\right)\right)\right), 1\right) \]
                    2. neg-sub0N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(0 - {M}^{2}\right)\right), 1\right) \]
                    3. --lowering--.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left({M}^{2}\right)\right)\right), 1\right) \]
                    4. unpow2N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(M \cdot M\right)\right)\right), 1\right) \]
                    5. *-lowering-*.f6458.3%

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(M, M\right)\right)\right), 1\right) \]
                  4. Simplified58.3%

                    \[\leadsto e^{\color{blue}{0 - M \cdot M}} \cdot 1 \]
                  5. Step-by-step derivation
                    1. *-rgt-identityN/A

                      \[\leadsto e^{0 - M \cdot M} \]
                    2. exp-diffN/A

                      \[\leadsto \frac{e^{0}}{\color{blue}{e^{M \cdot M}}} \]
                    3. 1-expN/A

                      \[\leadsto \frac{1}{e^{\color{blue}{M \cdot M}}} \]
                    4. /-lowering-/.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(e^{M \cdot M}\right)}\right) \]
                    5. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\left(M \cdot M\right)\right)\right) \]
                    6. *-lowering-*.f6458.3%

                      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(M, M\right)\right)\right) \]
                  6. Applied egg-rr58.3%

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

                  if 1.3e13 < n

                  1. Initial program 79.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                    14. +-lowering-+.f64N/A

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                    15. metadata-evalN/A

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                  3. Simplified79.2%

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
                  7. Simplified100.0%

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

                    \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                  9. Step-by-step derivation
                    1. Simplified100.0%

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(n \cdot \left(n \cdot \frac{-1}{4}\right)\right)\right), 1\right) \]
                      4. *-commutativeN/A

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(n, \left(\frac{-1}{4} \cdot n\right)\right)\right), 1\right) \]
                      6. *-commutativeN/A

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

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

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

                    \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 10^{-142}:\\ \;\;\;\;e^{\left|n - m\right| + m \cdot \left(m \cdot -0.25\right)}\\ \mathbf{elif}\;n \leq 13000000000000:\\ \;\;\;\;\frac{1}{e^{M \cdot M}}\\ \mathbf{else}:\\ \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\ \end{array} \]
                  12. Add Preprocessing

                  Alternative 6: 65.0% accurate, 2.0× speedup?

                  \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq 10^{-142}:\\ \;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;n \leq 13000000000000:\\ \;\;\;\;\frac{1}{e^{M \cdot M}}\\ \mathbf{else}:\\ \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\ \end{array} \end{array} \]
                  (FPCore (K m n M l)
                   :precision binary64
                   (if (<= n 1e-142)
                     (* (cos M) (exp (* -0.25 (* m m))))
                     (if (<= n 13000000000000.0) (/ 1.0 (exp (* M M))) (exp (* n (* n -0.25))))))
                  double code(double K, double m, double n, double M, double l) {
                  	double tmp;
                  	if (n <= 1e-142) {
                  		tmp = cos(M) * exp((-0.25 * (m * m)));
                  	} else if (n <= 13000000000000.0) {
                  		tmp = 1.0 / exp((M * M));
                  	} else {
                  		tmp = exp((n * (n * -0.25)));
                  	}
                  	return tmp;
                  }
                  
                  real(8) function code(k, m, n, m_1, l)
                      real(8), intent (in) :: k
                      real(8), intent (in) :: m
                      real(8), intent (in) :: n
                      real(8), intent (in) :: m_1
                      real(8), intent (in) :: l
                      real(8) :: tmp
                      if (n <= 1d-142) then
                          tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
                      else if (n <= 13000000000000.0d0) then
                          tmp = 1.0d0 / exp((m_1 * m_1))
                      else
                          tmp = exp((n * (n * (-0.25d0))))
                      end if
                      code = tmp
                  end function
                  
                  public static double code(double K, double m, double n, double M, double l) {
                  	double tmp;
                  	if (n <= 1e-142) {
                  		tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
                  	} else if (n <= 13000000000000.0) {
                  		tmp = 1.0 / Math.exp((M * M));
                  	} else {
                  		tmp = Math.exp((n * (n * -0.25)));
                  	}
                  	return tmp;
                  }
                  
                  def code(K, m, n, M, l):
                  	tmp = 0
                  	if n <= 1e-142:
                  		tmp = math.cos(M) * math.exp((-0.25 * (m * m)))
                  	elif n <= 13000000000000.0:
                  		tmp = 1.0 / math.exp((M * M))
                  	else:
                  		tmp = math.exp((n * (n * -0.25)))
                  	return tmp
                  
                  function code(K, m, n, M, l)
                  	tmp = 0.0
                  	if (n <= 1e-142)
                  		tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m))));
                  	elseif (n <= 13000000000000.0)
                  		tmp = Float64(1.0 / exp(Float64(M * M)));
                  	else
                  		tmp = exp(Float64(n * Float64(n * -0.25)));
                  	end
                  	return tmp
                  end
                  
                  function tmp_2 = code(K, m, n, M, l)
                  	tmp = 0.0;
                  	if (n <= 1e-142)
                  		tmp = cos(M) * exp((-0.25 * (m * m)));
                  	elseif (n <= 13000000000000.0)
                  		tmp = 1.0 / exp((M * M));
                  	else
                  		tmp = exp((n * (n * -0.25)));
                  	end
                  	tmp_2 = tmp;
                  end
                  
                  code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1e-142], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 13000000000000.0], N[(1.0 / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
                  
                  \begin{array}{l}
                  
                  \\
                  \begin{array}{l}
                  \mathbf{if}\;n \leq 10^{-142}:\\
                  \;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
                  
                  \mathbf{elif}\;n \leq 13000000000000:\\
                  \;\;\;\;\frac{1}{e^{M \cdot M}}\\
                  
                  \mathbf{else}:\\
                  \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
                  
                  
                  \end{array}
                  \end{array}
                  
                  Derivation
                  1. Split input into 3 regimes
                  2. if n < 1e-142

                    1. Initial program 76.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                      14. +-lowering-+.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                      15. metadata-evalN/A

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                    3. Simplified76.9%

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
                    7. Simplified97.4%

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right), \mathsf{cos.f64}\left(M\right)\right) \]
                    10. Simplified61.9%

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

                    if 1e-142 < n < 1.3e13

                    1. Initial program 78.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                      14. +-lowering-+.f64N/A

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                      15. metadata-evalN/A

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                    3. Simplified78.0%

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

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

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

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

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

                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                    9. Step-by-step derivation
                      1. Simplified91.7%

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot {M}^{2}\right)}\right), 1\right) \]
                      3. Step-by-step derivation
                        1. mul-1-negN/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(\mathsf{neg}\left({M}^{2}\right)\right)\right), 1\right) \]
                        2. neg-sub0N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(0 - {M}^{2}\right)\right), 1\right) \]
                        3. --lowering--.f64N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left({M}^{2}\right)\right)\right), 1\right) \]
                        4. unpow2N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(M \cdot M\right)\right)\right), 1\right) \]
                        5. *-lowering-*.f6458.3%

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(M, M\right)\right)\right), 1\right) \]
                      4. Simplified58.3%

                        \[\leadsto e^{\color{blue}{0 - M \cdot M}} \cdot 1 \]
                      5. Step-by-step derivation
                        1. *-rgt-identityN/A

                          \[\leadsto e^{0 - M \cdot M} \]
                        2. exp-diffN/A

                          \[\leadsto \frac{e^{0}}{\color{blue}{e^{M \cdot M}}} \]
                        3. 1-expN/A

                          \[\leadsto \frac{1}{e^{\color{blue}{M \cdot M}}} \]
                        4. /-lowering-/.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(e^{M \cdot M}\right)}\right) \]
                        5. exp-lowering-exp.f64N/A

                          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\left(M \cdot M\right)\right)\right) \]
                        6. *-lowering-*.f6458.3%

                          \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(M, M\right)\right)\right) \]
                      6. Applied egg-rr58.3%

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

                      if 1.3e13 < n

                      1. Initial program 79.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                        14. +-lowering-+.f64N/A

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                        15. metadata-evalN/A

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

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                      3. Simplified79.2%

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

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

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

                          \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
                      7. Simplified100.0%

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

                        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                      9. Step-by-step derivation
                        1. Simplified100.0%

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(n \cdot \left(n \cdot \frac{-1}{4}\right)\right)\right), 1\right) \]
                          4. *-commutativeN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(n, \left(\frac{-1}{4} \cdot n\right)\right)\right), 1\right) \]
                          6. *-commutativeN/A

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

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

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

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

                      Alternative 7: 65.0% accurate, 3.7× speedup?

                      \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;n \leq 1.5 \cdot 10^{-143}:\\ \;\;\;\;e^{m \cdot \left(m \cdot -0.25\right)}\\ \mathbf{elif}\;n \leq 13000000000000:\\ \;\;\;\;\frac{1}{e^{M \cdot M}}\\ \mathbf{else}:\\ \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\ \end{array} \end{array} \]
                      (FPCore (K m n M l)
                       :precision binary64
                       (if (<= n 1.5e-143)
                         (exp (* m (* m -0.25)))
                         (if (<= n 13000000000000.0) (/ 1.0 (exp (* M M))) (exp (* n (* n -0.25))))))
                      double code(double K, double m, double n, double M, double l) {
                      	double tmp;
                      	if (n <= 1.5e-143) {
                      		tmp = exp((m * (m * -0.25)));
                      	} else if (n <= 13000000000000.0) {
                      		tmp = 1.0 / exp((M * M));
                      	} else {
                      		tmp = exp((n * (n * -0.25)));
                      	}
                      	return tmp;
                      }
                      
                      real(8) function code(k, m, n, m_1, l)
                          real(8), intent (in) :: k
                          real(8), intent (in) :: m
                          real(8), intent (in) :: n
                          real(8), intent (in) :: m_1
                          real(8), intent (in) :: l
                          real(8) :: tmp
                          if (n <= 1.5d-143) then
                              tmp = exp((m * (m * (-0.25d0))))
                          else if (n <= 13000000000000.0d0) then
                              tmp = 1.0d0 / exp((m_1 * m_1))
                          else
                              tmp = exp((n * (n * (-0.25d0))))
                          end if
                          code = tmp
                      end function
                      
                      public static double code(double K, double m, double n, double M, double l) {
                      	double tmp;
                      	if (n <= 1.5e-143) {
                      		tmp = Math.exp((m * (m * -0.25)));
                      	} else if (n <= 13000000000000.0) {
                      		tmp = 1.0 / Math.exp((M * M));
                      	} else {
                      		tmp = Math.exp((n * (n * -0.25)));
                      	}
                      	return tmp;
                      }
                      
                      def code(K, m, n, M, l):
                      	tmp = 0
                      	if n <= 1.5e-143:
                      		tmp = math.exp((m * (m * -0.25)))
                      	elif n <= 13000000000000.0:
                      		tmp = 1.0 / math.exp((M * M))
                      	else:
                      		tmp = math.exp((n * (n * -0.25)))
                      	return tmp
                      
                      function code(K, m, n, M, l)
                      	tmp = 0.0
                      	if (n <= 1.5e-143)
                      		tmp = exp(Float64(m * Float64(m * -0.25)));
                      	elseif (n <= 13000000000000.0)
                      		tmp = Float64(1.0 / exp(Float64(M * M)));
                      	else
                      		tmp = exp(Float64(n * Float64(n * -0.25)));
                      	end
                      	return tmp
                      end
                      
                      function tmp_2 = code(K, m, n, M, l)
                      	tmp = 0.0;
                      	if (n <= 1.5e-143)
                      		tmp = exp((m * (m * -0.25)));
                      	elseif (n <= 13000000000000.0)
                      		tmp = 1.0 / exp((M * M));
                      	else
                      		tmp = exp((n * (n * -0.25)));
                      	end
                      	tmp_2 = tmp;
                      end
                      
                      code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1.5e-143], N[Exp[N[(m * N[(m * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 13000000000000.0], N[(1.0 / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
                      
                      \begin{array}{l}
                      
                      \\
                      \begin{array}{l}
                      \mathbf{if}\;n \leq 1.5 \cdot 10^{-143}:\\
                      \;\;\;\;e^{m \cdot \left(m \cdot -0.25\right)}\\
                      
                      \mathbf{elif}\;n \leq 13000000000000:\\
                      \;\;\;\;\frac{1}{e^{M \cdot M}}\\
                      
                      \mathbf{else}:\\
                      \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\
                      
                      
                      \end{array}
                      \end{array}
                      
                      Derivation
                      1. Split input into 3 regimes
                      2. if n < 1.49999999999999993e-143

                        1. Initial program 76.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                          14. +-lowering-+.f64N/A

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                          15. metadata-evalN/A

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                        3. Simplified76.9%

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
                        7. Simplified97.4%

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

                          \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                        9. Step-by-step derivation
                          1. Simplified97.9%

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

                            \[\leadsto \color{blue}{e^{\left(\left|n - m\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell}} \]
                          3. Step-by-step derivation
                            1. associate--l+N/A

                              \[\leadsto e^{\left|n - m\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                            2. fabs-subN/A

                              \[\leadsto e^{\left|m - n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                            3. sub-negN/A

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

                              \[\leadsto e^{\left|m + -1 \cdot n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                            5. fabs-negN/A

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

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

                              \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell\right)\right) \]
                            8. associate--l+N/A

                              \[\leadsto \mathsf{exp.f64}\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                            9. fabs-negN/A

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

                              \[\leadsto \mathsf{exp.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                            11. sub-negN/A

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

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

                              \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right|\right), \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                          4. Simplified86.4%

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

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

                              \[\leadsto \mathsf{exp.f64}\left(\left(\frac{-1}{4} \cdot \left(m \cdot m\right)\right)\right) \]
                            2. associate-*r*N/A

                              \[\leadsto \mathsf{exp.f64}\left(\left(\left(\frac{-1}{4} \cdot m\right) \cdot m\right)\right) \]
                            3. *-commutativeN/A

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

                              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \left(\frac{-1}{4} \cdot m\right)\right)\right) \]
                            5. *-commutativeN/A

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

                              \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \mathsf{*.f64}\left(m, \frac{-1}{4}\right)\right)\right) \]
                          7. Simplified61.9%

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

                          if 1.49999999999999993e-143 < n < 1.3e13

                          1. Initial program 78.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                            14. +-lowering-+.f64N/A

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                            15. metadata-evalN/A

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

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                          3. Simplified78.0%

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

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

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

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

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

                            \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                          9. Step-by-step derivation
                            1. Simplified91.7%

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

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot {M}^{2}\right)}\right), 1\right) \]
                            3. Step-by-step derivation
                              1. mul-1-negN/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(\mathsf{neg}\left({M}^{2}\right)\right)\right), 1\right) \]
                              2. neg-sub0N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(0 - {M}^{2}\right)\right), 1\right) \]
                              3. --lowering--.f64N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left({M}^{2}\right)\right)\right), 1\right) \]
                              4. unpow2N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(M \cdot M\right)\right)\right), 1\right) \]
                              5. *-lowering-*.f6458.3%

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(M, M\right)\right)\right), 1\right) \]
                            4. Simplified58.3%

                              \[\leadsto e^{\color{blue}{0 - M \cdot M}} \cdot 1 \]
                            5. Step-by-step derivation
                              1. *-rgt-identityN/A

                                \[\leadsto e^{0 - M \cdot M} \]
                              2. exp-diffN/A

                                \[\leadsto \frac{e^{0}}{\color{blue}{e^{M \cdot M}}} \]
                              3. 1-expN/A

                                \[\leadsto \frac{1}{e^{\color{blue}{M \cdot M}}} \]
                              4. /-lowering-/.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(e^{M \cdot M}\right)}\right) \]
                              5. exp-lowering-exp.f64N/A

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\left(M \cdot M\right)\right)\right) \]
                              6. *-lowering-*.f6458.3%

                                \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(M, M\right)\right)\right) \]
                            6. Applied egg-rr58.3%

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

                            if 1.3e13 < n

                            1. Initial program 79.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                              14. +-lowering-+.f64N/A

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                              15. metadata-evalN/A

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

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                            3. Simplified79.2%

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

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

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

                                \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
                            7. Simplified100.0%

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

                              \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                            9. Step-by-step derivation
                              1. Simplified100.0%

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

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

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

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

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(n \cdot \left(n \cdot \frac{-1}{4}\right)\right)\right), 1\right) \]
                                4. *-commutativeN/A

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

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{*.f64}\left(n, \left(\frac{-1}{4} \cdot n\right)\right)\right), 1\right) \]
                                6. *-commutativeN/A

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

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

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

                              \[\leadsto \begin{array}{l} \mathbf{if}\;n \leq 1.5 \cdot 10^{-143}:\\ \;\;\;\;e^{m \cdot \left(m \cdot -0.25\right)}\\ \mathbf{elif}\;n \leq 13000000000000:\\ \;\;\;\;\frac{1}{e^{M \cdot M}}\\ \mathbf{else}:\\ \;\;\;\;e^{n \cdot \left(n \cdot -0.25\right)}\\ \end{array} \]
                            12. Add Preprocessing

                            Alternative 8: 75.7% accurate, 3.7× speedup?

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

                              1. Initial program 75.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                14. +-lowering-+.f64N/A

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                15. metadata-evalN/A

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

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                              3. Simplified75.9%

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

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

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

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

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

                                \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                              9. Step-by-step derivation
                                1. Simplified100.0%

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

                                  \[\leadsto \color{blue}{e^{\left(\left|n - m\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell}} \]
                                3. Step-by-step derivation
                                  1. associate--l+N/A

                                    \[\leadsto e^{\left|n - m\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                                  2. fabs-subN/A

                                    \[\leadsto e^{\left|m - n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                                  3. sub-negN/A

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

                                    \[\leadsto e^{\left|m + -1 \cdot n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                                  5. fabs-negN/A

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

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

                                    \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell\right)\right) \]
                                  8. associate--l+N/A

                                    \[\leadsto \mathsf{exp.f64}\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                                  9. fabs-negN/A

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

                                    \[\leadsto \mathsf{exp.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                                  11. sub-negN/A

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

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

                                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right|\right), \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                                4. Simplified89.1%

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

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

                                    \[\leadsto \mathsf{exp.f64}\left(\left(\frac{-1}{4} \cdot \left(m \cdot m\right)\right)\right) \]
                                  2. associate-*r*N/A

                                    \[\leadsto \mathsf{exp.f64}\left(\left(\left(\frac{-1}{4} \cdot m\right) \cdot m\right)\right) \]
                                  3. *-commutativeN/A

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

                                    \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \left(\frac{-1}{4} \cdot m\right)\right)\right) \]
                                  5. *-commutativeN/A

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

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

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

                                if -54 < m < 1.99999999999999994e-28

                                1. Initial program 79.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                  14. +-lowering-+.f64N/A

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                  15. metadata-evalN/A

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

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                                3. Simplified79.6%

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

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

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

                                    \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
                                7. Simplified94.6%

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

                                  \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                                9. Step-by-step derivation
                                  1. Simplified94.6%

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

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot {M}^{2}\right)}\right), 1\right) \]
                                  3. Step-by-step derivation
                                    1. mul-1-negN/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(\mathsf{neg}\left({M}^{2}\right)\right)\right), 1\right) \]
                                    2. neg-sub0N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(0 - {M}^{2}\right)\right), 1\right) \]
                                    3. --lowering--.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left({M}^{2}\right)\right)\right), 1\right) \]
                                    4. unpow2N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \left(M \cdot M\right)\right)\right), 1\right) \]
                                    5. *-lowering-*.f6461.7%

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \mathsf{*.f64}\left(M, M\right)\right)\right), 1\right) \]
                                  4. Simplified61.7%

                                    \[\leadsto e^{\color{blue}{0 - M \cdot M}} \cdot 1 \]
                                  5. Step-by-step derivation
                                    1. *-rgt-identityN/A

                                      \[\leadsto e^{0 - M \cdot M} \]
                                    2. exp-diffN/A

                                      \[\leadsto \frac{e^{0}}{\color{blue}{e^{M \cdot M}}} \]
                                    3. 1-expN/A

                                      \[\leadsto \frac{1}{e^{\color{blue}{M \cdot M}}} \]
                                    4. /-lowering-/.f64N/A

                                      \[\leadsto \mathsf{/.f64}\left(1, \color{blue}{\left(e^{M \cdot M}\right)}\right) \]
                                    5. exp-lowering-exp.f64N/A

                                      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\left(M \cdot M\right)\right)\right) \]
                                    6. *-lowering-*.f6461.7%

                                      \[\leadsto \mathsf{/.f64}\left(1, \mathsf{exp.f64}\left(\mathsf{*.f64}\left(M, M\right)\right)\right) \]
                                  6. Applied egg-rr61.7%

                                    \[\leadsto \color{blue}{\frac{1}{e^{M \cdot M}}} \]
                                10. Recombined 2 regimes into one program.
                                11. Add Preprocessing

                                Alternative 9: 68.6% accurate, 3.7× speedup?

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

                                  1. Initial program 75.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                    14. +-lowering-+.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                    15. metadata-evalN/A

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

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                                  3. Simplified75.6%

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

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

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

                                      \[\leadsto \mathsf{*.f64}\left(\left(e^{\left(\left|m - n\right| + \left(M + \frac{-1}{2} \cdot \left(m + n\right)\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right) - \ell}\right), \color{blue}{\cos M}\right) \]
                                  7. Simplified98.8%

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

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(M, \mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{+.f64}\left(m, n\right)\right)\right), \mathsf{\_.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(m, n\right), \frac{1}{2}\right), M\right)\right), \ell\right)\right)\right), \color{blue}{1}\right) \]
                                  9. Step-by-step derivation
                                    1. Simplified99.5%

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

                                      \[\leadsto \color{blue}{e^{\left(\left|n - m\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell}} \]
                                    3. Step-by-step derivation
                                      1. associate--l+N/A

                                        \[\leadsto e^{\left|n - m\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                                      2. fabs-subN/A

                                        \[\leadsto e^{\left|m - n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                                      3. sub-negN/A

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

                                        \[\leadsto e^{\left|m + -1 \cdot n\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)} \]
                                      5. fabs-negN/A

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

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

                                        \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right)\right) - \ell\right)\right) \]
                                      8. associate--l+N/A

                                        \[\leadsto \mathsf{exp.f64}\left(\left(\left|\mathsf{neg}\left(\left(m + -1 \cdot n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                                      9. fabs-negN/A

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

                                        \[\leadsto \mathsf{exp.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right| + \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                                      11. sub-negN/A

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

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

                                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right|\right), \left(\left(M + \frac{-1}{2} \cdot m\right) \cdot \left(\frac{1}{2} \cdot m - M\right) - \ell\right)\right)\right) \]
                                    4. Simplified89.4%

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

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

                                        \[\leadsto \mathsf{exp.f64}\left(\left(\frac{-1}{4} \cdot \left(m \cdot m\right)\right)\right) \]
                                      2. associate-*r*N/A

                                        \[\leadsto \mathsf{exp.f64}\left(\left(\left(\frac{-1}{4} \cdot m\right) \cdot m\right)\right) \]
                                      3. *-commutativeN/A

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

                                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \left(\frac{-1}{4} \cdot m\right)\right)\right) \]
                                      5. *-commutativeN/A

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

                                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(m, \mathsf{*.f64}\left(m, \frac{-1}{4}\right)\right)\right) \]
                                    7. Simplified92.8%

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

                                    if -3.9999999999999998e-7 < m < 1.1e-26

                                    1. Initial program 80.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                      14. +-lowering-+.f64N/A

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                      15. metadata-evalN/A

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

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                                    3. Simplified80.0%

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

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

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

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

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

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \ell\right)}\right), \mathsf{cos.f64}\left(M\right)\right) \]
                                    9. Step-by-step derivation
                                      1. neg-mul-1N/A

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right), \mathsf{cos.f64}\left(M\right)\right) \]
                                      2. neg-sub0N/A

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(0 - \ell\right)\right), \mathsf{cos.f64}\left(M\right)\right) \]
                                      3. --lowering--.f6439.9%

                                        \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right), \mathsf{cos.f64}\left(M\right)\right) \]
                                    10. Simplified39.9%

                                      \[\leadsto e^{\color{blue}{0 - \ell}} \cdot \cos M \]
                                    11. Taylor expanded in M around 0

                                      \[\leadsto \color{blue}{e^{\mathsf{neg}\left(\ell\right)}} \]
                                    12. Step-by-step derivation
                                      1. exp-lowering-exp.f64N/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--.f6439.9%

                                        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right) \]
                                    13. Simplified39.9%

                                      \[\leadsto \color{blue}{e^{0 - \ell}} \]
                                  10. Recombined 2 regimes into one program.
                                  11. Add Preprocessing

                                  Alternative 10: 35.2% accurate, 4.1× speedup?

                                  \[\begin{array}{l} \\ e^{0 - \ell} \end{array} \]
                                  (FPCore (K m n M l) :precision binary64 (exp (- 0.0 l)))
                                  double code(double K, double m, double n, double M, double l) {
                                  	return exp((0.0 - l));
                                  }
                                  
                                  real(8) function code(k, m, n, m_1, l)
                                      real(8), intent (in) :: k
                                      real(8), intent (in) :: m
                                      real(8), intent (in) :: n
                                      real(8), intent (in) :: m_1
                                      real(8), intent (in) :: l
                                      code = exp((0.0d0 - l))
                                  end function
                                  
                                  public static double code(double K, double m, double n, double M, double l) {
                                  	return Math.exp((0.0 - l));
                                  }
                                  
                                  def code(K, m, n, M, l):
                                  	return math.exp((0.0 - l))
                                  
                                  function code(K, m, n, M, l)
                                  	return exp(Float64(0.0 - l))
                                  end
                                  
                                  function tmp = code(K, m, n, M, l)
                                  	tmp = exp((0.0 - l));
                                  end
                                  
                                  code[K_, m_, n_, M_, l_] := N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision]
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  e^{0 - \ell}
                                  \end{array}
                                  
                                  Derivation
                                  1. Initial program 77.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                    14. +-lowering-+.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                    15. metadata-evalN/A

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

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                                  3. Simplified77.5%

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

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

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

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

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

                                    \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \ell\right)}\right), \mathsf{cos.f64}\left(M\right)\right) \]
                                  9. Step-by-step derivation
                                    1. neg-mul-1N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right), \mathsf{cos.f64}\left(M\right)\right) \]
                                    2. neg-sub0N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\left(0 - \ell\right)\right), \mathsf{cos.f64}\left(M\right)\right) \]
                                    3. --lowering--.f6434.3%

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right), \mathsf{cos.f64}\left(M\right)\right) \]
                                  10. Simplified34.3%

                                    \[\leadsto e^{\color{blue}{0 - \ell}} \cdot \cos M \]
                                  11. Taylor expanded in M around 0

                                    \[\leadsto \color{blue}{e^{\mathsf{neg}\left(\ell\right)}} \]
                                  12. Step-by-step derivation
                                    1. exp-lowering-exp.f64N/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--.f6434.7%

                                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right) \]
                                  13. Simplified34.7%

                                    \[\leadsto \color{blue}{e^{0 - \ell}} \]
                                  14. Add Preprocessing

                                  Alternative 11: 7.1% accurate, 425.0× speedup?

                                  \[\begin{array}{l} \\ 1 \end{array} \]
                                  (FPCore (K m n M l) :precision binary64 1.0)
                                  double code(double K, double m, double n, double M, double l) {
                                  	return 1.0;
                                  }
                                  
                                  real(8) function code(k, m, n, m_1, l)
                                      real(8), intent (in) :: k
                                      real(8), intent (in) :: m
                                      real(8), intent (in) :: n
                                      real(8), intent (in) :: m_1
                                      real(8), intent (in) :: l
                                      code = 1.0d0
                                  end function
                                  
                                  public static double code(double K, double m, double n, double M, double l) {
                                  	return 1.0;
                                  }
                                  
                                  def code(K, m, n, M, l):
                                  	return 1.0
                                  
                                  function code(K, m, n, M, l)
                                  	return 1.0
                                  end
                                  
                                  function tmp = code(K, m, n, M, l)
                                  	tmp = 1.0;
                                  end
                                  
                                  code[K_, m_, n_, M_, l_] := 1.0
                                  
                                  \begin{array}{l}
                                  
                                  \\
                                  1
                                  \end{array}
                                  
                                  Derivation
                                  1. Initial program 77.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. *-lowering-*.f64N/A

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

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

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

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

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

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

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

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

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

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

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

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

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \left(m + n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                    14. +-lowering-+.f64N/A

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), \left(\mathsf{neg}\left(2\right)\right)\right)\right)\right), \left(e^{\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)}\right)\right) \]
                                    15. metadata-evalN/A

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

                                      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{+.f64}\left(M, \mathsf{/.f64}\left(\mathsf{*.f64}\left(K, \mathsf{+.f64}\left(m, n\right)\right), -2\right)\right)\right), \mathsf{exp.f64}\left(\left(\left(\mathsf{neg}\left({\left(\frac{m + n}{2} - M\right)}^{2}\right)\right) - \left(\ell - \left|m - n\right|\right)\right)\right)\right) \]
                                  3. Simplified77.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

                                    \[\leadsto \color{blue}{\cos \left(\frac{-1}{2} \cdot \left(K \cdot \left(m + n\right)\right)\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 \left(m + n\right)\right)\right)\right) \]
                                    2. *-lowering-*.f64N/A

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

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

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

                                      \[\leadsto \mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\left(n + m\right), K\right)\right)\right) \]
                                    6. +-lowering-+.f646.5%

                                      \[\leadsto \mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{-1}{2}, \mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), K\right)\right)\right) \]
                                  10. Simplified6.5%

                                    \[\leadsto \color{blue}{\cos \left(-0.5 \cdot \left(\left(n + m\right) \cdot K\right)\right)} \]
                                  11. Taylor expanded in K around 0

                                    \[\leadsto \color{blue}{1} \]
                                  12. Step-by-step derivation
                                    1. Simplified7.0%

                                      \[\leadsto \color{blue}{1} \]
                                    2. Add Preprocessing

                                    Reproduce

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