Maksimov and Kolovsky, Equation (32)

Percentage Accurate: 76.2% → 96.8%
Time: 14.6s
Alternatives: 12
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 12 alternatives:

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

Initial Program: 76.2% accurate, 1.0× speedup?

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

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

Alternative 1: 96.8% accurate, 1.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := 0.5 \cdot \left(n + m\right)\\ \cos M \cdot e^{\left(\left|n - m\right| - \ell\right) + \left(t\_0 - M\right) \cdot \left(M - t\_0\right)} \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (let* ((t_0 (* 0.5 (+ n m))))
   (* (cos M) (exp (+ (- (fabs (- n m)) l) (* (- t_0 M) (- M t_0)))))))
double code(double K, double m, double n, double M, double l) {
	double t_0 = 0.5 * (n + m);
	return cos(M) * exp(((fabs((n - m)) - l) + ((t_0 - M) * (M - t_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
    real(8) :: t_0
    t_0 = 0.5d0 * (n + m)
    code = cos(m_1) * exp(((abs((n - m)) - l) + ((t_0 - m_1) * (m_1 - t_0))))
end function
public static double code(double K, double m, double n, double M, double l) {
	double t_0 = 0.5 * (n + m);
	return Math.cos(M) * Math.exp(((Math.abs((n - m)) - l) + ((t_0 - M) * (M - t_0))));
}
def code(K, m, n, M, l):
	t_0 = 0.5 * (n + m)
	return math.cos(M) * math.exp(((math.fabs((n - m)) - l) + ((t_0 - M) * (M - t_0))))
function code(K, m, n, M, l)
	t_0 = Float64(0.5 * Float64(n + m))
	return Float64(cos(M) * exp(Float64(Float64(abs(Float64(n - m)) - l) + Float64(Float64(t_0 - M) * Float64(M - t_0)))))
end
function tmp = code(K, m, n, M, l)
	t_0 = 0.5 * (n + m);
	tmp = cos(M) * exp(((abs((n - m)) - l) + ((t_0 - M) * (M - t_0))));
end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] + N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right)\\
\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) + \left(t\_0 - M\right) \cdot \left(M - t\_0\right)}
\end{array}
\end{array}
Derivation
  1. Initial program 72.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \color{blue}{\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - \left(0.5 \cdot \left(n + m\right) - M\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right)}} \]
  6. Final simplification96.0%

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

Alternative 2: 94.9% accurate, 1.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \cos M \cdot e^{0 - M \cdot M}\\ \mathbf{if}\;M \leq -1.75 \cdot 10^{+20}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;M \leq 1.16 \cdot 10^{+77}:\\ \;\;\;\;e^{\left(\left|n - m\right| - \ell\right) + \left(\left(n + m\right) \cdot \left(n + m\right)\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (let* ((t_0 (* (cos M) (exp (- 0.0 (* M M))))))
   (if (<= M -1.75e+20)
     t_0
     (if (<= M 1.16e+77)
       (exp (+ (- (fabs (- n m)) l) (* (* (+ n m) (+ n m)) -0.25)))
       t_0))))
double code(double K, double m, double n, double M, double l) {
	double t_0 = cos(M) * exp((0.0 - (M * M)));
	double tmp;
	if (M <= -1.75e+20) {
		tmp = t_0;
	} else if (M <= 1.16e+77) {
		tmp = exp(((fabs((n - m)) - l) + (((n + m) * (n + m)) * -0.25)));
	} 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 = cos(m_1) * exp((0.0d0 - (m_1 * m_1)))
    if (m_1 <= (-1.75d+20)) then
        tmp = t_0
    else if (m_1 <= 1.16d+77) then
        tmp = exp(((abs((n - m)) - l) + (((n + m) * (n + m)) * (-0.25d0))))
    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.cos(M) * Math.exp((0.0 - (M * M)));
	double tmp;
	if (M <= -1.75e+20) {
		tmp = t_0;
	} else if (M <= 1.16e+77) {
		tmp = Math.exp(((Math.abs((n - m)) - l) + (((n + m) * (n + m)) * -0.25)));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(K, m, n, M, l):
	t_0 = math.cos(M) * math.exp((0.0 - (M * M)))
	tmp = 0
	if M <= -1.75e+20:
		tmp = t_0
	elif M <= 1.16e+77:
		tmp = math.exp(((math.fabs((n - m)) - l) + (((n + m) * (n + m)) * -0.25)))
	else:
		tmp = t_0
	return tmp
function code(K, m, n, M, l)
	t_0 = Float64(cos(M) * exp(Float64(0.0 - Float64(M * M))))
	tmp = 0.0
	if (M <= -1.75e+20)
		tmp = t_0;
	elseif (M <= 1.16e+77)
		tmp = exp(Float64(Float64(abs(Float64(n - m)) - l) + Float64(Float64(Float64(n + m) * Float64(n + m)) * -0.25)));
	else
		tmp = t_0;
	end
	return tmp
end
function tmp_2 = code(K, m, n, M, l)
	t_0 = cos(M) * exp((0.0 - (M * M)));
	tmp = 0.0;
	if (M <= -1.75e+20)
		tmp = t_0;
	elseif (M <= 1.16e+77)
		tmp = exp(((abs((n - m)) - l) + (((n + m) * (n + m)) * -0.25)));
	else
		tmp = t_0;
	end
	tmp_2 = tmp;
end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(0.0 - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -1.75e+20], t$95$0, If[LessEqual[M, 1.16e+77], N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] + N[(N[(N[(n + m), $MachinePrecision] * N[(n + m), $MachinePrecision]), $MachinePrecision] * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := \cos M \cdot e^{0 - M \cdot M}\\
\mathbf{if}\;M \leq -1.75 \cdot 10^{+20}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;M \leq 1.16 \cdot 10^{+77}:\\
\;\;\;\;e^{\left(\left|n - m\right| - \ell\right) + \left(\left(n + m\right) \cdot \left(n + m\right)\right) \cdot -0.25}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < -1.75e20 or 1.1600000000000001e77 < M

    1. Initial program 77.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.75e20 < M < 1.1600000000000001e77

    1. Initial program 68.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;M \leq -1.75 \cdot 10^{+20}:\\ \;\;\;\;\cos M \cdot e^{0 - M \cdot M}\\ \mathbf{elif}\;M \leq 1.16 \cdot 10^{+77}:\\ \;\;\;\;e^{\left(\left|n - m\right| - \ell\right) + \left(\left(n + m\right) \cdot \left(n + m\right)\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;\cos M \cdot e^{0 - M \cdot M}\\ \end{array} \]
  5. Add Preprocessing

Alternative 3: 65.3% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{if}\;n \leq -1.2 \cdot 10^{-189}:\\ \;\;\;\;\cos M \cdot t\_0\\ \mathbf{elif}\;n \leq 9.8 \cdot 10^{-77}:\\ \;\;\;\;\cos M \cdot e^{0 - M \cdot M}\\ \mathbf{elif}\;n \leq 0.0005:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (let* ((t_0 (exp (* -0.25 (* m m)))))
   (if (<= n -1.2e-189)
     (* (cos M) t_0)
     (if (<= n 9.8e-77)
       (* (cos M) (exp (- 0.0 (* M M))))
       (if (<= n 0.0005) t_0 (exp (* -0.25 (* n n))))))))
double code(double K, double m, double n, double M, double l) {
	double t_0 = exp((-0.25 * (m * m)));
	double tmp;
	if (n <= -1.2e-189) {
		tmp = cos(M) * t_0;
	} else if (n <= 9.8e-77) {
		tmp = cos(M) * exp((0.0 - (M * M)));
	} else if (n <= 0.0005) {
		tmp = t_0;
	} else {
		tmp = exp((-0.25 * (n * n)));
	}
	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(((-0.25d0) * (m * m)))
    if (n <= (-1.2d-189)) then
        tmp = cos(m_1) * t_0
    else if (n <= 9.8d-77) then
        tmp = cos(m_1) * exp((0.0d0 - (m_1 * m_1)))
    else if (n <= 0.0005d0) then
        tmp = t_0
    else
        tmp = exp(((-0.25d0) * (n * n)))
    end if
    code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
	double t_0 = Math.exp((-0.25 * (m * m)));
	double tmp;
	if (n <= -1.2e-189) {
		tmp = Math.cos(M) * t_0;
	} else if (n <= 9.8e-77) {
		tmp = Math.cos(M) * Math.exp((0.0 - (M * M)));
	} else if (n <= 0.0005) {
		tmp = t_0;
	} else {
		tmp = Math.exp((-0.25 * (n * n)));
	}
	return tmp;
}
def code(K, m, n, M, l):
	t_0 = math.exp((-0.25 * (m * m)))
	tmp = 0
	if n <= -1.2e-189:
		tmp = math.cos(M) * t_0
	elif n <= 9.8e-77:
		tmp = math.cos(M) * math.exp((0.0 - (M * M)))
	elif n <= 0.0005:
		tmp = t_0
	else:
		tmp = math.exp((-0.25 * (n * n)))
	return tmp
function code(K, m, n, M, l)
	t_0 = exp(Float64(-0.25 * Float64(m * m)))
	tmp = 0.0
	if (n <= -1.2e-189)
		tmp = Float64(cos(M) * t_0);
	elseif (n <= 9.8e-77)
		tmp = Float64(cos(M) * exp(Float64(0.0 - Float64(M * M))));
	elseif (n <= 0.0005)
		tmp = t_0;
	else
		tmp = exp(Float64(-0.25 * Float64(n * n)));
	end
	return tmp
end
function tmp_2 = code(K, m, n, M, l)
	t_0 = exp((-0.25 * (m * m)));
	tmp = 0.0;
	if (n <= -1.2e-189)
		tmp = cos(M) * t_0;
	elseif (n <= 9.8e-77)
		tmp = cos(M) * exp((0.0 - (M * M)));
	elseif (n <= 0.0005)
		tmp = t_0;
	else
		tmp = exp((-0.25 * (n * n)));
	end
	tmp_2 = tmp;
end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -1.2e-189], N[(N[Cos[M], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[n, 9.8e-77], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(0.0 - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 0.0005], t$95$0, N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{if}\;n \leq -1.2 \cdot 10^{-189}:\\
\;\;\;\;\cos M \cdot t\_0\\

\mathbf{elif}\;n \leq 9.8 \cdot 10^{-77}:\\
\;\;\;\;\cos M \cdot e^{0 - M \cdot M}\\

\mathbf{elif}\;n \leq 0.0005:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if n < -1.1999999999999999e-189

    1. Initial program 75.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -1.1999999999999999e-189 < n < 9.7999999999999994e-77

    1. Initial program 84.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if 9.7999999999999994e-77 < n < 5.0000000000000001e-4

    1. Initial program 66.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. Add Preprocessing
    3. Taylor expanded in K around 0

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    5. Simplified90.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right) \]
    11. Simplified79.5%

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

    if 5.0000000000000001e-4 < n

    1. Initial program 52.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 64.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -54:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -1 \cdot 10^{-87}:\\ \;\;\;\;\cos M \cdot e^{0 - \ell}\\ \mathbf{else}:\\ \;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (if (<= m -54.0)
   (exp (* -0.25 (* m m)))
   (if (<= m -1e-87)
     (* (cos M) (exp (- 0.0 l)))
     (* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
	double tmp;
	if (m <= -54.0) {
		tmp = exp((-0.25 * (m * m)));
	} else if (m <= -1e-87) {
		tmp = cos(M) * exp((0.0 - l));
	} else {
		tmp = cos(M) * exp((-0.25 * (n * n)));
	}
	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 <= (-54.0d0)) then
        tmp = exp(((-0.25d0) * (m * m)))
    else if (m <= (-1d-87)) then
        tmp = cos(m_1) * exp((0.0d0 - l))
    else
        tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
    end if
    code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
	double tmp;
	if (m <= -54.0) {
		tmp = Math.exp((-0.25 * (m * m)));
	} else if (m <= -1e-87) {
		tmp = Math.cos(M) * Math.exp((0.0 - l));
	} else {
		tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
	}
	return tmp;
}
def code(K, m, n, M, l):
	tmp = 0
	if m <= -54.0:
		tmp = math.exp((-0.25 * (m * m)))
	elif m <= -1e-87:
		tmp = math.cos(M) * math.exp((0.0 - l))
	else:
		tmp = math.cos(M) * math.exp((-0.25 * (n * n)))
	return tmp
function code(K, m, n, M, l)
	tmp = 0.0
	if (m <= -54.0)
		tmp = exp(Float64(-0.25 * Float64(m * m)));
	elseif (m <= -1e-87)
		tmp = Float64(cos(M) * exp(Float64(0.0 - l)));
	else
		tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n))));
	end
	return tmp
end
function tmp_2 = code(K, m, n, M, l)
	tmp = 0.0;
	if (m <= -54.0)
		tmp = exp((-0.25 * (m * m)));
	elseif (m <= -1e-87)
		tmp = cos(M) * exp((0.0 - l));
	else
		tmp = cos(M) * exp((-0.25 * (n * n)));
	end
	tmp_2 = tmp;
end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -54.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1e-87], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq -54:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\

\mathbf{elif}\;m \leq -1 \cdot 10^{-87}:\\
\;\;\;\;\cos M \cdot e^{0 - \ell}\\

\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if m < -54

    1. Initial program 70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -54 < m < -1.00000000000000002e-87

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(0 - \ell\right)\right)\right) \]
      3. --lowering--.f6456.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right)\right) \]
    8. Simplified56.5%

      \[\leadsto \cos M \cdot e^{\color{blue}{0 - \ell}} \]

    if -1.00000000000000002e-87 < m

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 5: 74.2% accurate, 2.0× speedup?

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

\\
\begin{array}{l}
\mathbf{if}\;m \leq -56:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\

\mathbf{else}:\\
\;\;\;\;e^{\left(\left|n - m\right| - \ell\right) + -0.25 \cdot \left(n \cdot n\right)}\\


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

    1. Initial program 70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -56 < m

    1. Initial program 73.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\color{blue}{\left({n}^{2}\right)}, \frac{-1}{4}\right)\right)\right) \]
    10. Step-by-step derivation
      1. unpow2N/A

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

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

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

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

Alternative 6: 64.2% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -54:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -1.75 \cdot 10^{-87}:\\ \;\;\;\;\cos M \cdot e^{0 - \ell}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (if (<= m -54.0)
   (exp (* -0.25 (* m m)))
   (if (<= m -1.75e-87) (* (cos M) (exp (- 0.0 l))) (exp (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
	double tmp;
	if (m <= -54.0) {
		tmp = exp((-0.25 * (m * m)));
	} else if (m <= -1.75e-87) {
		tmp = cos(M) * exp((0.0 - l));
	} else {
		tmp = exp((-0.25 * (n * n)));
	}
	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 <= (-54.0d0)) then
        tmp = exp(((-0.25d0) * (m * m)))
    else if (m <= (-1.75d-87)) then
        tmp = cos(m_1) * exp((0.0d0 - l))
    else
        tmp = exp(((-0.25d0) * (n * n)))
    end if
    code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
	double tmp;
	if (m <= -54.0) {
		tmp = Math.exp((-0.25 * (m * m)));
	} else if (m <= -1.75e-87) {
		tmp = Math.cos(M) * Math.exp((0.0 - l));
	} else {
		tmp = Math.exp((-0.25 * (n * n)));
	}
	return tmp;
}
def code(K, m, n, M, l):
	tmp = 0
	if m <= -54.0:
		tmp = math.exp((-0.25 * (m * m)))
	elif m <= -1.75e-87:
		tmp = math.cos(M) * math.exp((0.0 - l))
	else:
		tmp = math.exp((-0.25 * (n * n)))
	return tmp
function code(K, m, n, M, l)
	tmp = 0.0
	if (m <= -54.0)
		tmp = exp(Float64(-0.25 * Float64(m * m)));
	elseif (m <= -1.75e-87)
		tmp = Float64(cos(M) * exp(Float64(0.0 - l)));
	else
		tmp = exp(Float64(-0.25 * Float64(n * n)));
	end
	return tmp
end
function tmp_2 = code(K, m, n, M, l)
	tmp = 0.0;
	if (m <= -54.0)
		tmp = exp((-0.25 * (m * m)));
	elseif (m <= -1.75e-87)
		tmp = cos(M) * exp((0.0 - l));
	else
		tmp = exp((-0.25 * (n * n)));
	end
	tmp_2 = tmp;
end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -54.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.75e-87], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq -54:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\

\mathbf{elif}\;m \leq -1.75 \cdot 10^{-87}:\\
\;\;\;\;\cos M \cdot e^{0 - \ell}\\

\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if m < -54

    1. Initial program 70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -54 < m < -1.75000000000000006e-87

    1. Initial program 86.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(0 - \ell\right)\right)\right) \]
      3. --lowering--.f6456.5%

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right)\right) \]
    8. Simplified56.5%

      \[\leadsto \cos M \cdot e^{\color{blue}{0 - \ell}} \]

    if -1.75000000000000006e-87 < m

    1. Initial program 72.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 7: 63.9% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -54:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -1.8 \cdot 10^{-85}:\\ \;\;\;\;e^{\left|n - m\right| - \ell}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (if (<= m -54.0)
   (exp (* -0.25 (* m m)))
   (if (<= m -1.8e-85) (exp (- (fabs (- n m)) l)) (exp (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
	double tmp;
	if (m <= -54.0) {
		tmp = exp((-0.25 * (m * m)));
	} else if (m <= -1.8e-85) {
		tmp = exp((fabs((n - m)) - l));
	} else {
		tmp = exp((-0.25 * (n * n)));
	}
	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 <= (-54.0d0)) then
        tmp = exp(((-0.25d0) * (m * m)))
    else if (m <= (-1.8d-85)) then
        tmp = exp((abs((n - m)) - l))
    else
        tmp = exp(((-0.25d0) * (n * n)))
    end if
    code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
	double tmp;
	if (m <= -54.0) {
		tmp = Math.exp((-0.25 * (m * m)));
	} else if (m <= -1.8e-85) {
		tmp = Math.exp((Math.abs((n - m)) - l));
	} else {
		tmp = Math.exp((-0.25 * (n * n)));
	}
	return tmp;
}
def code(K, m, n, M, l):
	tmp = 0
	if m <= -54.0:
		tmp = math.exp((-0.25 * (m * m)))
	elif m <= -1.8e-85:
		tmp = math.exp((math.fabs((n - m)) - l))
	else:
		tmp = math.exp((-0.25 * (n * n)))
	return tmp
function code(K, m, n, M, l)
	tmp = 0.0
	if (m <= -54.0)
		tmp = exp(Float64(-0.25 * Float64(m * m)));
	elseif (m <= -1.8e-85)
		tmp = exp(Float64(abs(Float64(n - m)) - l));
	else
		tmp = exp(Float64(-0.25 * Float64(n * n)));
	end
	return tmp
end
function tmp_2 = code(K, m, n, M, l)
	tmp = 0.0;
	if (m <= -54.0)
		tmp = exp((-0.25 * (m * m)));
	elseif (m <= -1.8e-85)
		tmp = exp((abs((n - m)) - l));
	else
		tmp = exp((-0.25 * (n * n)));
	end
	tmp_2 = tmp;
end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -54.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.8e-85], N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq -54:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\

\mathbf{elif}\;m \leq -1.8 \cdot 10^{-85}:\\
\;\;\;\;e^{\left|n - m\right| - \ell}\\

\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if m < -54

    1. Initial program 70.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -54 < m < -1.7999999999999999e-85

    1. Initial program 85.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    5. Simplified88.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\color{blue}{\left({n}^{2}\right)}, \frac{-1}{4}\right)\right)\right) \]
    10. Step-by-step derivation
      1. unpow2N/A

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

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

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

      \[\leadsto \color{blue}{e^{\left|m - n\right| - \ell}} \]
    13. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

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

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \ell\right)\right) \]
      3. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m - n\right)\right), \ell\right)\right) \]
      4. --lowering--.f6453.0%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right)\right) \]
    14. Simplified53.0%

      \[\leadsto \color{blue}{e^{\left|m - n\right| - \ell}} \]

    if -1.7999999999999999e-85 < m

    1. Initial program 72.1%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -54:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -1.8 \cdot 10^{-85}:\\ \;\;\;\;e^{\left|n - m\right| - \ell}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \]
  5. Add Preprocessing

Alternative 8: 69.6% accurate, 3.7× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{if}\;m \leq -54:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;m \leq 54:\\ \;\;\;\;e^{0 - \ell}\\ \mathbf{else}:\\ \;\;\;\;t\_0\\ \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (let* ((t_0 (exp (* -0.25 (* m m)))))
   (if (<= m -54.0) t_0 (if (<= m 54.0) (exp (- 0.0 l)) t_0))))
double code(double K, double m, double n, double M, double l) {
	double t_0 = exp((-0.25 * (m * m)));
	double tmp;
	if (m <= -54.0) {
		tmp = t_0;
	} else if (m <= 54.0) {
		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(((-0.25d0) * (m * m)))
    if (m <= (-54.0d0)) then
        tmp = t_0
    else if (m <= 54.0d0) 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((-0.25 * (m * m)));
	double tmp;
	if (m <= -54.0) {
		tmp = t_0;
	} else if (m <= 54.0) {
		tmp = Math.exp((0.0 - l));
	} else {
		tmp = t_0;
	}
	return tmp;
}
def code(K, m, n, M, l):
	t_0 = math.exp((-0.25 * (m * m)))
	tmp = 0
	if m <= -54.0:
		tmp = t_0
	elif m <= 54.0:
		tmp = math.exp((0.0 - l))
	else:
		tmp = t_0
	return tmp
function code(K, m, n, M, l)
	t_0 = exp(Float64(-0.25 * Float64(m * m)))
	tmp = 0.0
	if (m <= -54.0)
		tmp = t_0;
	elseif (m <= 54.0)
		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((-0.25 * (m * m)));
	tmp = 0.0;
	if (m <= -54.0)
		tmp = t_0;
	elseif (m <= 54.0)
		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[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -54.0], t$95$0, If[LessEqual[m, 54.0], N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{if}\;m \leq -54:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;m \leq 54:\\
\;\;\;\;e^{0 - \ell}\\

\mathbf{else}:\\
\;\;\;\;t\_0\\


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -54 or 54 < m

    1. Initial program 67.7%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    5. Simplified99.2%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -54 < m < 54

    1. Initial program 77.8%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    5. Simplified92.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \ell\right)}\right) \]
    10. Step-by-step derivation
      1. neg-mul-1N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right) \]
      2. neg-sub0N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(0 - \ell\right)\right) \]
      3. --lowering--.f6446.3%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right) \]
    11. Simplified46.3%

      \[\leadsto e^{\color{blue}{0 - \ell}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 9: 65.6% accurate, 3.9× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -0.0031:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\ \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (if (<= m -0.0031) (exp (* -0.25 (* m m))) (exp (* -0.25 (* n n)))))
double code(double K, double m, double n, double M, double l) {
	double tmp;
	if (m <= -0.0031) {
		tmp = exp((-0.25 * (m * m)));
	} else {
		tmp = exp((-0.25 * (n * n)));
	}
	return tmp;
}
real(8) function code(k, m, n, m_1, l)
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8), intent (in) :: n
    real(8), intent (in) :: m_1
    real(8), intent (in) :: l
    real(8) :: tmp
    if (m <= (-0.0031d0)) then
        tmp = exp(((-0.25d0) * (m * m)))
    else
        tmp = exp(((-0.25d0) * (n * n)))
    end if
    code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
	double tmp;
	if (m <= -0.0031) {
		tmp = Math.exp((-0.25 * (m * m)));
	} else {
		tmp = Math.exp((-0.25 * (n * n)));
	}
	return tmp;
}
def code(K, m, n, M, l):
	tmp = 0
	if m <= -0.0031:
		tmp = math.exp((-0.25 * (m * m)))
	else:
		tmp = math.exp((-0.25 * (n * n)))
	return tmp
function code(K, m, n, M, l)
	tmp = 0.0
	if (m <= -0.0031)
		tmp = exp(Float64(-0.25 * Float64(m * m)));
	else
		tmp = exp(Float64(-0.25 * Float64(n * n)));
	end
	return tmp
end
function tmp_2 = code(K, m, n, M, l)
	tmp = 0.0;
	if (m <= -0.0031)
		tmp = exp((-0.25 * (m * m)));
	else
		tmp = exp((-0.25 * (n * n)));
	end
	tmp_2 = tmp;
end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.0031], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}

\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.0031:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\

\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\


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

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n - m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      14. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    5. Simplified97.5%

      \[\leadsto \color{blue}{\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - \left(0.5 \cdot \left(n + m\right) - M\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right)}} \]
    6. Taylor expanded in M around 0

      \[\leadsto \color{blue}{e^{\left|n - m\right| - \left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)}} \]
    7. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left|n - m\right| - \left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      2. associate--r+N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|n - m\right| - \ell\right) - \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right) \]
      3. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|n - m\right| - \ell\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right| - \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|n - m\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      6. fabs-subN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      7. sub-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m + -1 \cdot n\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      9. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m - n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      12. --lowering--.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      13. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\mathsf{neg}\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right)\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\mathsf{neg}\left({\left(m + n\right)}^{2} \cdot \frac{1}{4}\right)\right)\right)\right) \]
      15. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left({\left(m + n\right)}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left({\left(m + n\right)}^{2} \cdot \frac{-1}{4}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\left({\left(m + n\right)}^{2}\right), \frac{-1}{4}\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\left(m + n\right) \cdot \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
      19. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(n + m\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
      21. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
      22. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \left(n + m\right)\right), \frac{-1}{4}\right)\right)\right) \]
      23. +-lowering-+.f6497.5%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \mathsf{+.f64}\left(n, m\right)\right), \frac{-1}{4}\right)\right)\right) \]
    8. Simplified97.5%

      \[\leadsto \color{blue}{e^{\left(\left|m - n\right| - \ell\right) + \left(\left(n + m\right) \cdot \left(n + m\right)\right) \cdot -0.25}} \]
    9. Taylor expanded in m around inf

      \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {m}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left({m}^{2}\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left(m \cdot m\right)\right)\right) \]
      3. *-lowering-*.f6494.9%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(m, m\right)\right)\right) \]
    11. Simplified94.9%

      \[\leadsto e^{\color{blue}{-0.25 \cdot \left(m \cdot m\right)}} \]

    if -0.00309999999999999989 < m

    1. Initial program 73.4%

      \[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
    2. Add Preprocessing
    3. Taylor expanded in K around 0

      \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
    4. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(M\right)\right), \color{blue}{\left(e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}\right)}\right) \]
      2. cos-negN/A

        \[\leadsto \mathsf{*.f64}\left(\cos M, \left(e^{\color{blue}{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}}\right)\right) \]
      3. cos-lowering-cos.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}}\right)\right) \]
      4. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      5. associate--r+N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\left|m - n\right| - \ell\right) - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right) \]
      6. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right| - \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      7. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      8. fabs-subN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n - m\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      9. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + \left(\mathsf{neg}\left(m\right)\right)\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + -1 \cdot m\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      11. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + -1 \cdot m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      12. mul-1-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + \left(\mathsf{neg}\left(m\right)\right)\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      13. sub-negN/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n - m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      14. --lowering--.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
      15. unpow2N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
      16. *-lowering-*.f64N/A

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    5. Simplified95.4%

      \[\leadsto \color{blue}{\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - \left(0.5 \cdot \left(n + m\right) - M\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right)}} \]
    6. Taylor expanded in M around 0

      \[\leadsto \color{blue}{e^{\left|n - m\right| - \left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)}} \]
    7. Step-by-step derivation
      1. exp-lowering-exp.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left|n - m\right| - \left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      2. associate--r+N/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|n - m\right| - \ell\right) - \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right) \]
      3. cancel-sign-sub-invN/A

        \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|n - m\right| - \ell\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right) \]
      4. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right| - \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      5. --lowering--.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|n - m\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      6. fabs-subN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      7. sub-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      8. mul-1-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m + -1 \cdot n\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      9. fabs-lowering-fabs.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      10. mul-1-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      11. sub-negN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m - n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      12. --lowering--.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
      13. distribute-lft-neg-inN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\mathsf{neg}\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right)\right)\right) \]
      14. *-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\mathsf{neg}\left({\left(m + n\right)}^{2} \cdot \frac{1}{4}\right)\right)\right)\right) \]
      15. distribute-rgt-neg-inN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left({\left(m + n\right)}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right)\right) \]
      16. metadata-evalN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left({\left(m + n\right)}^{2} \cdot \frac{-1}{4}\right)\right)\right) \]
      17. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\left({\left(m + n\right)}^{2}\right), \frac{-1}{4}\right)\right)\right) \]
      18. unpow2N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\left(m + n\right) \cdot \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
      19. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
      20. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(n + m\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
      21. +-lowering-+.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
      22. +-commutativeN/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \left(n + m\right)\right), \frac{-1}{4}\right)\right)\right) \]
      23. +-lowering-+.f6484.7%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \mathsf{+.f64}\left(n, m\right)\right), \frac{-1}{4}\right)\right)\right) \]
    8. Simplified84.7%

      \[\leadsto \color{blue}{e^{\left(\left|m - n\right| - \ell\right) + \left(\left(n + m\right) \cdot \left(n + m\right)\right) \cdot -0.25}} \]
    9. Taylor expanded in n around inf

      \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(\frac{-1}{4} \cdot {n}^{2}\right)}\right) \]
    10. Step-by-step derivation
      1. *-lowering-*.f64N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left({n}^{2}\right)\right)\right) \]
      2. unpow2N/A

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \left(n \cdot n\right)\right)\right) \]
      3. *-lowering-*.f6453.4%

        \[\leadsto \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{-1}{4}, \mathsf{*.f64}\left(n, n\right)\right)\right) \]
    11. Simplified53.4%

      \[\leadsto e^{\color{blue}{-0.25 \cdot \left(n \cdot n\right)}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 10: 35.9% 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 72.5%

    \[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in K around 0

    \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(M\right)\right), \color{blue}{\left(e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}\right)}\right) \]
    2. cos-negN/A

      \[\leadsto \mathsf{*.f64}\left(\cos M, \left(e^{\color{blue}{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}}\right)\right) \]
    3. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}}\right)\right) \]
    4. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    5. associate--r+N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\left|m - n\right| - \ell\right) - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right| - \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    8. fabs-subN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n - m\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    9. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + \left(\mathsf{neg}\left(m\right)\right)\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    10. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + -1 \cdot m\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    11. fabs-lowering-fabs.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + -1 \cdot m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    12. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + \left(\mathsf{neg}\left(m\right)\right)\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    13. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n - m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    14. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
  5. Simplified96.0%

    \[\leadsto \color{blue}{\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - \left(0.5 \cdot \left(n + m\right) - M\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right)}} \]
  6. Taylor expanded in M around 0

    \[\leadsto \color{blue}{e^{\left|n - m\right| - \left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)}} \]
  7. Step-by-step derivation
    1. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left|n - m\right| - \left(\ell + \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    2. associate--r+N/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|n - m\right| - \ell\right) - \frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right) \]
    3. cancel-sign-sub-invN/A

      \[\leadsto \mathsf{exp.f64}\left(\left(\left(\left|n - m\right| - \ell\right) + \left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right) \]
    4. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\left(\left|n - m\right| - \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    5. --lowering--.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|n - m\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    6. fabs-subN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    7. sub-negN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m + \left(\mathsf{neg}\left(n\right)\right)\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    8. mul-1-negN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\left(\left|m + -1 \cdot n\right|\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    9. fabs-lowering-fabs.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m + -1 \cdot n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    10. mul-1-negN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m + \left(\mathsf{neg}\left(n\right)\right)\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    11. sub-negN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(m - n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    12. --lowering--.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\left(\mathsf{neg}\left(\frac{1}{4}\right)\right) \cdot {\left(m + n\right)}^{2}\right)\right)\right) \]
    13. distribute-lft-neg-inN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\mathsf{neg}\left(\frac{1}{4} \cdot {\left(m + n\right)}^{2}\right)\right)\right)\right) \]
    14. *-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left(\mathsf{neg}\left({\left(m + n\right)}^{2} \cdot \frac{1}{4}\right)\right)\right)\right) \]
    15. distribute-rgt-neg-inN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left({\left(m + n\right)}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right)\right) \]
    16. metadata-evalN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \left({\left(m + n\right)}^{2} \cdot \frac{-1}{4}\right)\right)\right) \]
    17. *-lowering-*.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\left({\left(m + n\right)}^{2}\right), \frac{-1}{4}\right)\right)\right) \]
    18. unpow2N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\left(m + n\right) \cdot \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
    19. *-lowering-*.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(m + n\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
    20. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\left(n + m\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
    21. +-lowering-+.f64N/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \left(m + n\right)\right), \frac{-1}{4}\right)\right)\right) \]
    22. +-commutativeN/A

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \left(n + m\right)\right), \frac{-1}{4}\right)\right)\right) \]
    23. +-lowering-+.f6488.4%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right), \ell\right), \mathsf{*.f64}\left(\mathsf{*.f64}\left(\mathsf{+.f64}\left(n, m\right), \mathsf{+.f64}\left(n, m\right)\right), \frac{-1}{4}\right)\right)\right) \]
  8. Simplified88.4%

    \[\leadsto \color{blue}{e^{\left(\left|m - n\right| - \ell\right) + \left(\left(n + m\right) \cdot \left(n + m\right)\right) \cdot -0.25}} \]
  9. Taylor expanded in l around inf

    \[\leadsto \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \ell\right)}\right) \]
  10. Step-by-step derivation
    1. neg-mul-1N/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--.f6437.0%

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right) \]
  11. Simplified37.0%

    \[\leadsto e^{\color{blue}{0 - \ell}} \]
  12. Add Preprocessing

Alternative 11: 6.9% accurate, 4.2× speedup?

\[\begin{array}{l} \\ \cos M \end{array} \]
(FPCore (K m n M l) :precision binary64 (cos M))
double code(double K, double m, double n, double M, double l) {
	return cos(M);
}
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(m_1)
end function
public static double code(double K, double m, double n, double M, double l) {
	return Math.cos(M);
}
def code(K, m, n, M, l):
	return math.cos(M)
function code(K, m, n, M, l)
	return cos(M)
end
function tmp = code(K, m, n, M, l)
	tmp = cos(M);
end
code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}

\\
\cos M
\end{array}
Derivation
  1. Initial program 72.5%

    \[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in K around 0

    \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(M\right)\right), \color{blue}{\left(e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}\right)}\right) \]
    2. cos-negN/A

      \[\leadsto \mathsf{*.f64}\left(\cos M, \left(e^{\color{blue}{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}}\right)\right) \]
    3. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}}\right)\right) \]
    4. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    5. associate--r+N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\left|m - n\right| - \ell\right) - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right| - \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    8. fabs-subN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n - m\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    9. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + \left(\mathsf{neg}\left(m\right)\right)\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    10. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + -1 \cdot m\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    11. fabs-lowering-fabs.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + -1 \cdot m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    12. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + \left(\mathsf{neg}\left(m\right)\right)\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    13. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n - m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    14. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
  5. Simplified96.0%

    \[\leadsto \color{blue}{\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - \left(0.5 \cdot \left(n + m\right) - M\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right)}} \]
  6. Taylor expanded in l around inf

    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \ell\right)}\right)\right) \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(0 - \ell\right)\right)\right) \]
    3. --lowering--.f6437.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right)\right) \]
  8. Simplified37.7%

    \[\leadsto \cos M \cdot e^{\color{blue}{0 - \ell}} \]
  9. Taylor expanded in l around 0

    \[\leadsto \color{blue}{\cos M} \]
  10. Step-by-step derivation
    1. cos-lowering-cos.f648.3%

      \[\leadsto \mathsf{cos.f64}\left(M\right) \]
  11. Simplified8.3%

    \[\leadsto \color{blue}{\cos M} \]
  12. Add Preprocessing

Alternative 12: 6.9% 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 72.5%

    \[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
  2. Add Preprocessing
  3. Taylor expanded in K around 0

    \[\leadsto \color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}} \]
  4. Step-by-step derivation
    1. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\cos \left(\mathsf{neg}\left(M\right)\right), \color{blue}{\left(e^{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}\right)}\right) \]
    2. cos-negN/A

      \[\leadsto \mathsf{*.f64}\left(\cos M, \left(e^{\color{blue}{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}}\right)\right) \]
    3. cos-lowering-cos.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \left(e^{\color{blue}{\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)}}\right)\right) \]
    4. exp-lowering-exp.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left|m - n\right| - \left(\ell + {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    5. associate--r+N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\left(\left|m - n\right| - \ell\right) - {\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right) \]
    6. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right| - \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    7. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|m - n\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    8. fabs-subN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n - m\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    9. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + \left(\mathsf{neg}\left(m\right)\right)\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    10. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\left(\left|n + -1 \cdot m\right|\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    11. fabs-lowering-fabs.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + -1 \cdot m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    12. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n + \left(\mathsf{neg}\left(m\right)\right)\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    13. sub-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\left(n - m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    14. --lowering--.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left({\left(\frac{1}{2} \cdot \left(m + n\right) - M\right)}^{2}\right)\right)\right)\right) \]
    15. unpow2N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right) \cdot \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
    16. *-lowering-*.f64N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{\_.f64}\left(\mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(n, m\right)\right), \ell\right), \mathsf{*.f64}\left(\left(\frac{1}{2} \cdot \left(m + n\right) - M\right), \left(\frac{1}{2} \cdot \left(m + n\right) - M\right)\right)\right)\right)\right) \]
  5. Simplified96.0%

    \[\leadsto \color{blue}{\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - \left(0.5 \cdot \left(n + m\right) - M\right) \cdot \left(0.5 \cdot \left(n + m\right) - M\right)}} \]
  6. Taylor expanded in l around inf

    \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\left(-1 \cdot \ell\right)}\right)\right) \]
  7. Step-by-step derivation
    1. mul-1-negN/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right)\right) \]
    2. neg-sub0N/A

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\left(0 - \ell\right)\right)\right) \]
    3. --lowering--.f6437.7%

      \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right)\right) \]
  8. Simplified37.7%

    \[\leadsto \cos M \cdot e^{\color{blue}{0 - \ell}} \]
  9. Taylor expanded in l around 0

    \[\leadsto \color{blue}{\cos M} \]
  10. Step-by-step derivation
    1. cos-lowering-cos.f648.3%

      \[\leadsto \mathsf{cos.f64}\left(M\right) \]
  11. Simplified8.3%

    \[\leadsto \color{blue}{\cos M} \]
  12. Taylor expanded in M around 0

    \[\leadsto \color{blue}{1} \]
  13. Step-by-step derivation
    1. Simplified8.2%

      \[\leadsto \color{blue}{1} \]
    2. Add Preprocessing

    Reproduce

    ?
    herbie shell --seed 2024191 
    (FPCore (K m n M l)
      :name "Maksimov and Kolovsky, Equation (32)"
      :precision binary64
      (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))