Maksimov and Kolovsky, Equation (32)

Percentage Accurate: 76.5% → 96.9%
Time: 13.5s
Alternatives: 10
Speedup: 1.3×

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 10 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.5% 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.9% accurate, 1.3× speedup?

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

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
  6. Step-by-step derivation
    1. cos-negN/A

      \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
    2. cos-lowering-cos.f6497.4%

      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
  7. Simplified97.4%

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

Alternative 2: 65.1% accurate, 2.0× speedup?

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

\mathbf{elif}\;n \leq 6:\\
\;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 3 regimes
  2. if n < 3e-132

    1. Initial program 74.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-negN/A

        \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
      2. cos-lowering-cos.f6498.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
    7. Simplified98.4%

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({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-*.f6461.4%

        \[\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) \]
    10. Simplified61.4%

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

    if 3e-132 < n < 6

    1. Initial program 80.6%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-negN/A

        \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
      2. cos-lowering-cos.f6488.4%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
    7. Simplified88.4%

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

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

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

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

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

    if 6 < n

    1. Initial program 71.9%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-negN/A

        \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
      2. cos-lowering-cos.f64100.0%

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

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

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

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

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

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

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

Alternative 3: 76.4% accurate, 2.0× speedup?

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

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

\mathbf{elif}\;m \leq 8.5 \cdot 10^{-9}:\\
\;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -14500 or 8.5e-9 < m

    1. Initial program 70.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-negN/A

        \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
      2. cos-lowering-cos.f6499.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
    7. Simplified99.3%

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

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

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({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-*.f6496.6%

        \[\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) \]
    10. Simplified96.6%

      \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(m \cdot m\right)}}} \]
    11. Taylor expanded in M around 0

      \[\leadsto \color{blue}{\frac{1}{e^{\frac{1}{4} \cdot {m}^{2}}}} \]
    12. Step-by-step derivation
      1. rec-expN/A

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

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

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

        \[\leadsto \mathsf{exp.f64}\left(\left({m}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \]
      5. metadata-evalN/A

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

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

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

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

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

    if -14500 < m < 8.5e-9

    1. Initial program 80.5%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-negN/A

        \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
      2. cos-lowering-cos.f6495.0%

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

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

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

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

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

      \[\leadsto \frac{\cos M}{e^{\color{blue}{M \cdot M}}} \]
  3. Recombined 2 regimes into one program.
  4. Add Preprocessing

Alternative 4: 72.0% accurate, 3.3× speedup?

\[\begin{array}{l} \\ \begin{array}{l} t_0 := e^{\left(m \cdot m\right) \cdot -0.25}\\ \mathbf{if}\;\ell \leq -1.65 \cdot 10^{+87}:\\ \;\;\;\;\frac{\cos M}{1 + \ell \cdot \left(1 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-78}:\\ \;\;\;\;t\_0\\ \mathbf{elif}\;\ell \leq 9 \cdot 10^{-278}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \cos \left(0.5 \cdot \left(n \cdot K\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 720:\\ \;\;\;\;t\_0\\ \mathbf{else}:\\ \;\;\;\;e^{0 - \ell}\\ \end{array} \end{array} \]
(FPCore (K m n M l)
 :precision binary64
 (let* ((t_0 (exp (* (* m m) -0.25))))
   (if (<= l -1.65e+87)
     (/ (cos M) (+ 1.0 (* l (+ 1.0 (* l (+ 0.5 (* l 0.16666666666666666)))))))
     (if (<= l -1e-78)
       t_0
       (if (<= l 9e-278)
         (* -0.16666666666666666 (* (* l (* l l)) (cos (* 0.5 (* n K)))))
         (if (<= l 720.0) t_0 (exp (- 0.0 l))))))))
double code(double K, double m, double n, double M, double l) {
	double t_0 = exp(((m * m) * -0.25));
	double tmp;
	if (l <= -1.65e+87) {
		tmp = cos(M) / (1.0 + (l * (1.0 + (l * (0.5 + (l * 0.16666666666666666))))));
	} else if (l <= -1e-78) {
		tmp = t_0;
	} else if (l <= 9e-278) {
		tmp = -0.16666666666666666 * ((l * (l * l)) * cos((0.5 * (n * K))));
	} else if (l <= 720.0) {
		tmp = t_0;
	} else {
		tmp = exp((0.0 - l));
	}
	return tmp;
}
real(8) function code(k, m, n, m_1, l)
    real(8), intent (in) :: k
    real(8), intent (in) :: m
    real(8), intent (in) :: n
    real(8), intent (in) :: m_1
    real(8), intent (in) :: l
    real(8) :: t_0
    real(8) :: tmp
    t_0 = exp(((m * m) * (-0.25d0)))
    if (l <= (-1.65d+87)) then
        tmp = cos(m_1) / (1.0d0 + (l * (1.0d0 + (l * (0.5d0 + (l * 0.16666666666666666d0))))))
    else if (l <= (-1d-78)) then
        tmp = t_0
    else if (l <= 9d-278) then
        tmp = (-0.16666666666666666d0) * ((l * (l * l)) * cos((0.5d0 * (n * k))))
    else if (l <= 720.0d0) then
        tmp = t_0
    else
        tmp = exp((0.0d0 - l))
    end if
    code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
	double t_0 = Math.exp(((m * m) * -0.25));
	double tmp;
	if (l <= -1.65e+87) {
		tmp = Math.cos(M) / (1.0 + (l * (1.0 + (l * (0.5 + (l * 0.16666666666666666))))));
	} else if (l <= -1e-78) {
		tmp = t_0;
	} else if (l <= 9e-278) {
		tmp = -0.16666666666666666 * ((l * (l * l)) * Math.cos((0.5 * (n * K))));
	} else if (l <= 720.0) {
		tmp = t_0;
	} else {
		tmp = Math.exp((0.0 - l));
	}
	return tmp;
}
def code(K, m, n, M, l):
	t_0 = math.exp(((m * m) * -0.25))
	tmp = 0
	if l <= -1.65e+87:
		tmp = math.cos(M) / (1.0 + (l * (1.0 + (l * (0.5 + (l * 0.16666666666666666))))))
	elif l <= -1e-78:
		tmp = t_0
	elif l <= 9e-278:
		tmp = -0.16666666666666666 * ((l * (l * l)) * math.cos((0.5 * (n * K))))
	elif l <= 720.0:
		tmp = t_0
	else:
		tmp = math.exp((0.0 - l))
	return tmp
function code(K, m, n, M, l)
	t_0 = exp(Float64(Float64(m * m) * -0.25))
	tmp = 0.0
	if (l <= -1.65e+87)
		tmp = Float64(cos(M) / Float64(1.0 + Float64(l * Float64(1.0 + Float64(l * Float64(0.5 + Float64(l * 0.16666666666666666)))))));
	elseif (l <= -1e-78)
		tmp = t_0;
	elseif (l <= 9e-278)
		tmp = Float64(-0.16666666666666666 * Float64(Float64(l * Float64(l * l)) * cos(Float64(0.5 * Float64(n * K)))));
	elseif (l <= 720.0)
		tmp = t_0;
	else
		tmp = exp(Float64(0.0 - l));
	end
	return tmp
end
function tmp_2 = code(K, m, n, M, l)
	t_0 = exp(((m * m) * -0.25));
	tmp = 0.0;
	if (l <= -1.65e+87)
		tmp = cos(M) / (1.0 + (l * (1.0 + (l * (0.5 + (l * 0.16666666666666666))))));
	elseif (l <= -1e-78)
		tmp = t_0;
	elseif (l <= 9e-278)
		tmp = -0.16666666666666666 * ((l * (l * l)) * cos((0.5 * (n * K))));
	elseif (l <= 720.0)
		tmp = t_0;
	else
		tmp = exp((0.0 - l));
	end
	tmp_2 = tmp;
end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[l, -1.65e+87], N[(N[Cos[M], $MachinePrecision] / N[(1.0 + N[(l * N[(1.0 + N[(l * N[(0.5 + N[(l * 0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -1e-78], t$95$0, If[LessEqual[l, 9e-278], N[(-0.16666666666666666 * N[(N[(l * N[(l * l), $MachinePrecision]), $MachinePrecision] * N[Cos[N[(0.5 * N[(n * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 720.0], t$95$0, N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}

\\
\begin{array}{l}
t_0 := e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{if}\;\ell \leq -1.65 \cdot 10^{+87}:\\
\;\;\;\;\frac{\cos M}{1 + \ell \cdot \left(1 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)}\\

\mathbf{elif}\;\ell \leq -1 \cdot 10^{-78}:\\
\;\;\;\;t\_0\\

\mathbf{elif}\;\ell \leq 9 \cdot 10^{-278}:\\
\;\;\;\;-0.16666666666666666 \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \cos \left(0.5 \cdot \left(n \cdot K\right)\right)\right)\\

\mathbf{elif}\;\ell \leq 720:\\
\;\;\;\;t\_0\\

\mathbf{else}:\\
\;\;\;\;e^{0 - \ell}\\


\end{array}
\end{array}
Derivation
  1. Split input into 4 regimes
  2. if l < -1.6500000000000001e87

    1. Initial program 65.1%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-negN/A

        \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
      2. cos-lowering-cos.f6495.3%

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
    7. Simplified95.3%

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

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

        \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
      2. Taylor expanded in l around 0

        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \color{blue}{\left(1 + \ell \cdot \left(1 + \ell \cdot \left(\frac{1}{2} + \frac{1}{6} \cdot \ell\right)\right)\right)}\right) \]
      3. Step-by-step derivation
        1. +-lowering-+.f64N/A

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{2}, \left(\ell \cdot \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
        7. *-lowering-*.f6481.8%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\ell, \color{blue}{\frac{1}{6}}\right)\right)\right)\right)\right)\right)\right) \]
      4. Simplified81.8%

        \[\leadsto \frac{\cos M}{\color{blue}{1 + \ell \cdot \left(1 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)}} \]

      if -1.6500000000000001e87 < l < -9.99999999999999999e-79 or 8.9999999999999996e-278 < l < 720

      1. Initial program 76.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. cos-negN/A

          \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
        2. cos-lowering-cos.f6496.2%

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
      7. Simplified96.2%

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

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

          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({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-*.f6462.5%

          \[\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) \]
      10. Simplified62.5%

        \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(m \cdot m\right)}}} \]
      11. Taylor expanded in M around 0

        \[\leadsto \color{blue}{\frac{1}{e^{\frac{1}{4} \cdot {m}^{2}}}} \]
      12. Step-by-step derivation
        1. rec-expN/A

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

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

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

          \[\leadsto \mathsf{exp.f64}\left(\left({m}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \]
        5. metadata-evalN/A

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

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

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

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

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

      if -9.99999999999999999e-79 < l < 8.9999999999999996e-278

      1. Initial program 80.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 l around inf

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

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

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

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n \cdot K\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right)\right) \]
        3. *-lowering-*.f647.5%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right)\right) \]
      8. Simplified7.5%

        \[\leadsto \cos \color{blue}{\left(0.5 \cdot \left(n \cdot K\right)\right)} \cdot e^{0 - \ell} \]
      9. Taylor expanded in l around 0

        \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \color{blue}{\left(1 + \ell \cdot \left(\ell \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot \ell\right) - 1\right)\right)}\right) \]
      10. Step-by-step derivation
        1. +-lowering-+.f64N/A

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \color{blue}{\left(\ell \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot \ell\right) - 1\right)}\right)\right)\right) \]
        3. sub-negN/A

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

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

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

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

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{-1}{6} \cdot \ell\right)\right)\right), -1\right)\right)\right)\right) \]
        8. *-lowering-*.f647.5%

          \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{6}, \ell\right)\right)\right), -1\right)\right)\right)\right) \]
      11. Simplified7.5%

        \[\leadsto \cos \left(0.5 \cdot \left(n \cdot K\right)\right) \cdot \color{blue}{\left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + -0.16666666666666666 \cdot \ell\right) + -1\right)\right)} \]
      12. Taylor expanded in l around inf

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

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

          \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left({\ell}^{3}\right), \color{blue}{\cos \left(\frac{1}{2} \cdot \left(K \cdot n\right)\right)}\right)\right) \]
        3. cube-multN/A

          \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right), \cos \color{blue}{\left(\frac{1}{2} \cdot \left(K \cdot n\right)\right)}\right)\right) \]
        4. unpow2N/A

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

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

          \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \left(\ell \cdot \ell\right)\right), \cos \left(\frac{1}{2} \cdot \color{blue}{\left(K \cdot n\right)}\right)\right)\right) \]
        7. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right), \cos \left(\frac{1}{2} \cdot \color{blue}{\left(K \cdot n\right)}\right)\right)\right) \]
        8. cos-lowering-cos.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{cos.f64}\left(\left(\frac{1}{2} \cdot \left(K \cdot n\right)\right)\right)\right)\right) \]
        9. *-lowering-*.f64N/A

          \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(K \cdot n\right)\right)\right)\right)\right) \]
        10. *-lowering-*.f6480.4%

          \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(K, n\right)\right)\right)\right)\right) \]
      14. Simplified80.4%

        \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \cos \left(0.5 \cdot \left(K \cdot n\right)\right)\right)} \]

      if 720 < l

      1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. cos-negN/A

          \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
        2. cos-lowering-cos.f64100.0%

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

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

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

          \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
        2. Taylor expanded in M around 0

          \[\leadsto \color{blue}{\frac{1}{e^{\ell}}} \]
        3. Step-by-step derivation
          1. rec-expN/A

            \[\leadsto e^{\mathsf{neg}\left(\ell\right)} \]
          2. neg-mul-1N/A

            \[\leadsto e^{-1 \cdot \ell} \]
          3. exp-lowering-exp.f64N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \ell\right)\right) \]
          4. neg-mul-1N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right) \]
          5. neg-sub0N/A

            \[\leadsto \mathsf{exp.f64}\left(\left(0 - \ell\right)\right) \]
          6. --lowering--.f64100.0%

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

          \[\leadsto \color{blue}{e^{0 - \ell}} \]
      10. Recombined 4 regimes into one program.
      11. Final simplification79.5%

        \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -1.65 \cdot 10^{+87}:\\ \;\;\;\;\frac{\cos M}{1 + \ell \cdot \left(1 + \ell \cdot \left(0.5 + \ell \cdot 0.16666666666666666\right)\right)}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-78}:\\ \;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\ \mathbf{elif}\;\ell \leq 9 \cdot 10^{-278}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \cos \left(0.5 \cdot \left(n \cdot K\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 720:\\ \;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;e^{0 - \ell}\\ \end{array} \]
      12. Add Preprocessing

      Alternative 5: 70.3% accurate, 3.3× speedup?

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

        1. Initial program 62.9%

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
        6. Step-by-step derivation
          1. cos-negN/A

            \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
          2. cos-lowering-cos.f6494.3%

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
        7. Simplified94.3%

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

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

            \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
          2. Taylor expanded in l around 0

            \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \color{blue}{\left(1 + \ell \cdot \left(1 + \frac{1}{2} \cdot \ell\right)\right)}\right) \]
          3. Step-by-step derivation
            1. +-lowering-+.f64N/A

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot \ell\right)}\right)\right)\right)\right) \]
            4. *-lowering-*.f6472.6%

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\ell}\right)\right)\right)\right)\right) \]
          4. Simplified72.6%

            \[\leadsto \frac{\cos M}{\color{blue}{1 + \ell \cdot \left(1 + 0.5 \cdot \ell\right)}} \]

          if -7.99999999999999937e134 < l < -9.99999999999999999e-79 or 8.9999999999999996e-278 < l < 740

          1. Initial program 75.9%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. cos-negN/A

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
          7. Simplified96.5%

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

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

              \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({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-*.f6463.5%

              \[\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) \]
          10. Simplified63.5%

            \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(m \cdot m\right)}}} \]
          11. Taylor expanded in M around 0

            \[\leadsto \color{blue}{\frac{1}{e^{\frac{1}{4} \cdot {m}^{2}}}} \]
          12. Step-by-step derivation
            1. rec-expN/A

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

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

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

              \[\leadsto \mathsf{exp.f64}\left(\left({m}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \]
            5. metadata-evalN/A

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

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

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

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

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

          if -9.99999999999999999e-79 < l < 8.9999999999999996e-278

          1. Initial program 80.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 l around inf

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

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

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

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(n \cdot K\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right)\right) \]
            3. *-lowering-*.f647.5%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right)\right) \]
          8. Simplified7.5%

            \[\leadsto \cos \color{blue}{\left(0.5 \cdot \left(n \cdot K\right)\right)} \cdot e^{0 - \ell} \]
          9. Taylor expanded in l around 0

            \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \color{blue}{\left(1 + \ell \cdot \left(\ell \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot \ell\right) - 1\right)\right)}\right) \]
          10. Step-by-step derivation
            1. +-lowering-+.f64N/A

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \color{blue}{\left(\ell \cdot \left(\frac{1}{2} + \frac{-1}{6} \cdot \ell\right) - 1\right)}\right)\right)\right) \]
            3. sub-negN/A

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

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

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

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

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{2}, \left(\frac{-1}{6} \cdot \ell\right)\right)\right), -1\right)\right)\right)\right) \]
            8. *-lowering-*.f647.5%

              \[\leadsto \mathsf{*.f64}\left(\mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(n, K\right)\right)\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(\frac{-1}{6}, \ell\right)\right)\right), -1\right)\right)\right)\right) \]
          11. Simplified7.5%

            \[\leadsto \cos \left(0.5 \cdot \left(n \cdot K\right)\right) \cdot \color{blue}{\left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + -0.16666666666666666 \cdot \ell\right) + -1\right)\right)} \]
          12. Taylor expanded in l around inf

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

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

              \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left({\ell}^{3}\right), \color{blue}{\cos \left(\frac{1}{2} \cdot \left(K \cdot n\right)\right)}\right)\right) \]
            3. cube-multN/A

              \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right), \cos \color{blue}{\left(\frac{1}{2} \cdot \left(K \cdot n\right)\right)}\right)\right) \]
            4. unpow2N/A

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

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

              \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \left(\ell \cdot \ell\right)\right), \cos \left(\frac{1}{2} \cdot \color{blue}{\left(K \cdot n\right)}\right)\right)\right) \]
            7. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right), \cos \left(\frac{1}{2} \cdot \color{blue}{\left(K \cdot n\right)}\right)\right)\right) \]
            8. cos-lowering-cos.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{cos.f64}\left(\left(\frac{1}{2} \cdot \left(K \cdot n\right)\right)\right)\right)\right) \]
            9. *-lowering-*.f64N/A

              \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \left(K \cdot n\right)\right)\right)\right)\right) \]
            10. *-lowering-*.f6480.4%

              \[\leadsto \mathsf{*.f64}\left(\frac{-1}{6}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(\ell, \mathsf{*.f64}\left(\ell, \ell\right)\right), \mathsf{cos.f64}\left(\mathsf{*.f64}\left(\frac{1}{2}, \mathsf{*.f64}\left(K, n\right)\right)\right)\right)\right) \]
          14. Simplified80.4%

            \[\leadsto \color{blue}{-0.16666666666666666 \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \cos \left(0.5 \cdot \left(K \cdot n\right)\right)\right)} \]

          if 740 < l

          1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

            \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
          6. Step-by-step derivation
            1. cos-negN/A

              \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
            2. cos-lowering-cos.f64100.0%

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

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

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

              \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
            2. Taylor expanded in M around 0

              \[\leadsto \color{blue}{\frac{1}{e^{\ell}}} \]
            3. Step-by-step derivation
              1. rec-expN/A

                \[\leadsto e^{\mathsf{neg}\left(\ell\right)} \]
              2. neg-mul-1N/A

                \[\leadsto e^{-1 \cdot \ell} \]
              3. exp-lowering-exp.f64N/A

                \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \ell\right)\right) \]
              4. neg-mul-1N/A

                \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right) \]
              5. neg-sub0N/A

                \[\leadsto \mathsf{exp.f64}\left(\left(0 - \ell\right)\right) \]
              6. --lowering--.f64100.0%

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

              \[\leadsto \color{blue}{e^{0 - \ell}} \]
          10. Recombined 4 regimes into one program.
          11. Final simplification78.1%

            \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -8 \cdot 10^{+134}:\\ \;\;\;\;\frac{\cos M}{1 + \ell \cdot \left(1 + \ell \cdot 0.5\right)}\\ \mathbf{elif}\;\ell \leq -1 \cdot 10^{-78}:\\ \;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\ \mathbf{elif}\;\ell \leq 9 \cdot 10^{-278}:\\ \;\;\;\;-0.16666666666666666 \cdot \left(\left(\ell \cdot \left(\ell \cdot \ell\right)\right) \cdot \cos \left(0.5 \cdot \left(n \cdot K\right)\right)\right)\\ \mathbf{elif}\;\ell \leq 740:\\ \;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;e^{0 - \ell}\\ \end{array} \]
          12. Add Preprocessing

          Alternative 6: 68.0% accurate, 3.7× speedup?

          \[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;\ell \leq -8 \cdot 10^{+134}:\\ \;\;\;\;\frac{\cos M}{1 + \ell \cdot \left(1 + \ell \cdot 0.5\right)}\\ \mathbf{elif}\;\ell \leq 740:\\ \;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;e^{0 - \ell}\\ \end{array} \end{array} \]
          (FPCore (K m n M l)
           :precision binary64
           (if (<= l -8e+134)
             (/ (cos M) (+ 1.0 (* l (+ 1.0 (* l 0.5)))))
             (if (<= l 740.0) (exp (* (* m m) -0.25)) (exp (- 0.0 l)))))
          double code(double K, double m, double n, double M, double l) {
          	double tmp;
          	if (l <= -8e+134) {
          		tmp = cos(M) / (1.0 + (l * (1.0 + (l * 0.5))));
          	} else if (l <= 740.0) {
          		tmp = exp(((m * m) * -0.25));
          	} else {
          		tmp = exp((0.0 - l));
          	}
          	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 (l <= (-8d+134)) then
                  tmp = cos(m_1) / (1.0d0 + (l * (1.0d0 + (l * 0.5d0))))
              else if (l <= 740.0d0) then
                  tmp = exp(((m * m) * (-0.25d0)))
              else
                  tmp = exp((0.0d0 - l))
              end if
              code = tmp
          end function
          
          public static double code(double K, double m, double n, double M, double l) {
          	double tmp;
          	if (l <= -8e+134) {
          		tmp = Math.cos(M) / (1.0 + (l * (1.0 + (l * 0.5))));
          	} else if (l <= 740.0) {
          		tmp = Math.exp(((m * m) * -0.25));
          	} else {
          		tmp = Math.exp((0.0 - l));
          	}
          	return tmp;
          }
          
          def code(K, m, n, M, l):
          	tmp = 0
          	if l <= -8e+134:
          		tmp = math.cos(M) / (1.0 + (l * (1.0 + (l * 0.5))))
          	elif l <= 740.0:
          		tmp = math.exp(((m * m) * -0.25))
          	else:
          		tmp = math.exp((0.0 - l))
          	return tmp
          
          function code(K, m, n, M, l)
          	tmp = 0.0
          	if (l <= -8e+134)
          		tmp = Float64(cos(M) / Float64(1.0 + Float64(l * Float64(1.0 + Float64(l * 0.5)))));
          	elseif (l <= 740.0)
          		tmp = exp(Float64(Float64(m * m) * -0.25));
          	else
          		tmp = exp(Float64(0.0 - l));
          	end
          	return tmp
          end
          
          function tmp_2 = code(K, m, n, M, l)
          	tmp = 0.0;
          	if (l <= -8e+134)
          		tmp = cos(M) / (1.0 + (l * (1.0 + (l * 0.5))));
          	elseif (l <= 740.0)
          		tmp = exp(((m * m) * -0.25));
          	else
          		tmp = exp((0.0 - l));
          	end
          	tmp_2 = tmp;
          end
          
          code[K_, m_, n_, M_, l_] := If[LessEqual[l, -8e+134], N[(N[Cos[M], $MachinePrecision] / N[(1.0 + N[(l * N[(1.0 + N[(l * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 740.0], N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision]]]
          
          \begin{array}{l}
          
          \\
          \begin{array}{l}
          \mathbf{if}\;\ell \leq -8 \cdot 10^{+134}:\\
          \;\;\;\;\frac{\cos M}{1 + \ell \cdot \left(1 + \ell \cdot 0.5\right)}\\
          
          \mathbf{elif}\;\ell \leq 740:\\
          \;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\
          
          \mathbf{else}:\\
          \;\;\;\;e^{0 - \ell}\\
          
          
          \end{array}
          \end{array}
          
          Derivation
          1. Split input into 3 regimes
          2. if l < -7.99999999999999937e134

            1. Initial program 62.9%

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

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

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

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

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

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

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

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

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

              \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
            6. Step-by-step derivation
              1. cos-negN/A

                \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
              2. cos-lowering-cos.f6494.3%

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
            7. Simplified94.3%

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

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

                \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
              2. Taylor expanded in l around 0

                \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \color{blue}{\left(1 + \ell \cdot \left(1 + \frac{1}{2} \cdot \ell\right)\right)}\right) \]
              3. Step-by-step derivation
                1. +-lowering-+.f64N/A

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

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

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(1, \color{blue}{\left(\frac{1}{2} \cdot \ell\right)}\right)\right)\right)\right) \]
                4. *-lowering-*.f6472.6%

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\ell, \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\frac{1}{2}, \color{blue}{\ell}\right)\right)\right)\right)\right) \]
              4. Simplified72.6%

                \[\leadsto \frac{\cos M}{\color{blue}{1 + \ell \cdot \left(1 + 0.5 \cdot \ell\right)}} \]

              if -7.99999999999999937e134 < l < 740

              1. Initial program 77.5%

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
              6. Step-by-step derivation
                1. cos-negN/A

                  \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                2. cos-lowering-cos.f6496.9%

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
              7. Simplified96.9%

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

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

                  \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({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-*.f6461.8%

                  \[\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) \]
              10. Simplified61.8%

                \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(m \cdot m\right)}}} \]
              11. Taylor expanded in M around 0

                \[\leadsto \color{blue}{\frac{1}{e^{\frac{1}{4} \cdot {m}^{2}}}} \]
              12. Step-by-step derivation
                1. rec-expN/A

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

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

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

                  \[\leadsto \mathsf{exp.f64}\left(\left({m}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \]
                5. metadata-evalN/A

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

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

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

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

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

              if 740 < l

              1. Initial program 75.0%

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

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

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

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

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

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

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

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

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

                \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
              6. Step-by-step derivation
                1. cos-negN/A

                  \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                2. cos-lowering-cos.f64100.0%

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

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

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

                  \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
                2. Taylor expanded in M around 0

                  \[\leadsto \color{blue}{\frac{1}{e^{\ell}}} \]
                3. Step-by-step derivation
                  1. rec-expN/A

                    \[\leadsto e^{\mathsf{neg}\left(\ell\right)} \]
                  2. neg-mul-1N/A

                    \[\leadsto e^{-1 \cdot \ell} \]
                  3. exp-lowering-exp.f64N/A

                    \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \ell\right)\right) \]
                  4. neg-mul-1N/A

                    \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right) \]
                  5. neg-sub0N/A

                    \[\leadsto \mathsf{exp.f64}\left(\left(0 - \ell\right)\right) \]
                  6. --lowering--.f64100.0%

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

                  \[\leadsto \color{blue}{e^{0 - \ell}} \]
              10. Recombined 3 regimes into one program.
              11. Final simplification74.0%

                \[\leadsto \begin{array}{l} \mathbf{if}\;\ell \leq -8 \cdot 10^{+134}:\\ \;\;\;\;\frac{\cos M}{1 + \ell \cdot \left(1 + \ell \cdot 0.5\right)}\\ \mathbf{elif}\;\ell \leq 740:\\ \;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25}\\ \mathbf{else}:\\ \;\;\;\;e^{0 - \ell}\\ \end{array} \]
              12. Add Preprocessing

              Alternative 7: 69.1% accurate, 3.7× speedup?

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

                1. Initial program 69.9%

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
                6. Step-by-step derivation
                  1. cos-negN/A

                    \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                  2. cos-lowering-cos.f6499.3%

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                7. Simplified99.3%

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

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

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({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-*.f6497.9%

                    \[\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) \]
                10. Simplified97.9%

                  \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(m \cdot m\right)}}} \]
                11. Taylor expanded in M around 0

                  \[\leadsto \color{blue}{\frac{1}{e^{\frac{1}{4} \cdot {m}^{2}}}} \]
                12. Step-by-step derivation
                  1. rec-expN/A

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

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

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

                    \[\leadsto \mathsf{exp.f64}\left(\left({m}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \]
                  5. metadata-evalN/A

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

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

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

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

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

                if -4.19999999999999977e-5 < m < 55

                1. Initial program 80.9%

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
                6. Step-by-step derivation
                  1. cos-negN/A

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

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

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

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

                    \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
                  2. Taylor expanded in M around 0

                    \[\leadsto \color{blue}{\frac{1}{e^{\ell}}} \]
                  3. Step-by-step derivation
                    1. rec-expN/A

                      \[\leadsto e^{\mathsf{neg}\left(\ell\right)} \]
                    2. neg-mul-1N/A

                      \[\leadsto e^{-1 \cdot \ell} \]
                    3. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \ell\right)\right) \]
                    4. neg-mul-1N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right) \]
                    5. neg-sub0N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \ell\right)\right) \]
                    6. --lowering--.f6441.6%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right) \]
                  4. Simplified41.6%

                    \[\leadsto \color{blue}{e^{0 - \ell}} \]
                10. Recombined 2 regimes into one program.
                11. Add Preprocessing

                Alternative 8: 35.2% accurate, 4.1× speedup?

                \[\begin{array}{l} \\ e^{0 - \ell} \end{array} \]
                (FPCore (K m n M l) :precision binary64 (exp (- 0.0 l)))
                double code(double K, double m, double n, double M, double l) {
                	return exp((0.0 - l));
                }
                
                real(8) function code(k, m, n, m_1, l)
                    real(8), intent (in) :: k
                    real(8), intent (in) :: m
                    real(8), intent (in) :: n
                    real(8), intent (in) :: m_1
                    real(8), intent (in) :: l
                    code = exp((0.0d0 - l))
                end function
                
                public static double code(double K, double m, double n, double M, double l) {
                	return Math.exp((0.0 - l));
                }
                
                def code(K, m, n, M, l):
                	return math.exp((0.0 - l))
                
                function code(K, m, n, M, l)
                	return exp(Float64(0.0 - l))
                end
                
                function tmp = code(K, m, n, M, l)
                	tmp = exp((0.0 - l));
                end
                
                code[K_, m_, n_, M_, l_] := N[Exp[N[(0.0 - l), $MachinePrecision]], $MachinePrecision]
                
                \begin{array}{l}
                
                \\
                e^{0 - \ell}
                \end{array}
                
                Derivation
                1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

                  \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
                6. Step-by-step derivation
                  1. cos-negN/A

                    \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                  2. cos-lowering-cos.f6497.4%

                    \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                7. Simplified97.4%

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

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

                    \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
                  2. Taylor expanded in M around 0

                    \[\leadsto \color{blue}{\frac{1}{e^{\ell}}} \]
                  3. Step-by-step derivation
                    1. rec-expN/A

                      \[\leadsto e^{\mathsf{neg}\left(\ell\right)} \]
                    2. neg-mul-1N/A

                      \[\leadsto e^{-1 \cdot \ell} \]
                    3. exp-lowering-exp.f64N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(-1 \cdot \ell\right)\right) \]
                    4. neg-mul-1N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(\mathsf{neg}\left(\ell\right)\right)\right) \]
                    5. neg-sub0N/A

                      \[\leadsto \mathsf{exp.f64}\left(\left(0 - \ell\right)\right) \]
                    6. --lowering--.f6433.9%

                      \[\leadsto \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(0, \ell\right)\right) \]
                  4. Simplified33.9%

                    \[\leadsto \color{blue}{e^{0 - \ell}} \]
                  5. Add Preprocessing

                  Alternative 9: 7.5% accurate, 85.0× speedup?

                  \[\begin{array}{l} \\ \frac{1}{\ell + 1} \end{array} \]
                  (FPCore (K m n M l) :precision binary64 (/ 1.0 (+ l 1.0)))
                  double code(double K, double m, double n, double M, double l) {
                  	return 1.0 / (l + 1.0);
                  }
                  
                  real(8) function code(k, m, n, m_1, l)
                      real(8), intent (in) :: k
                      real(8), intent (in) :: m
                      real(8), intent (in) :: n
                      real(8), intent (in) :: m_1
                      real(8), intent (in) :: l
                      code = 1.0d0 / (l + 1.0d0)
                  end function
                  
                  public static double code(double K, double m, double n, double M, double l) {
                  	return 1.0 / (l + 1.0);
                  }
                  
                  def code(K, m, n, M, l):
                  	return 1.0 / (l + 1.0)
                  
                  function code(K, m, n, M, l)
                  	return Float64(1.0 / Float64(l + 1.0))
                  end
                  
                  function tmp = code(K, m, n, M, l)
                  	tmp = 1.0 / (l + 1.0);
                  end
                  
                  code[K_, m_, n_, M_, l_] := N[(1.0 / N[(l + 1.0), $MachinePrecision]), $MachinePrecision]
                  
                  \begin{array}{l}
                  
                  \\
                  \frac{1}{\ell + 1}
                  \end{array}
                  
                  Derivation
                  1. Initial program 74.8%

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

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

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

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

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

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

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

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

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

                    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
                  6. Step-by-step derivation
                    1. cos-negN/A

                      \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                    2. cos-lowering-cos.f6497.4%

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                  7. Simplified97.4%

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

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

                      \[\leadsto \frac{\cos M}{e^{\color{blue}{\ell}}} \]
                    2. Taylor expanded in l around 0

                      \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \color{blue}{\left(1 + \ell\right)}\right) \]
                    3. Step-by-step derivation
                      1. +-lowering-+.f646.0%

                        \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{+.f64}\left(1, \color{blue}{\ell}\right)\right) \]
                    4. Simplified6.0%

                      \[\leadsto \frac{\cos M}{\color{blue}{1 + \ell}} \]
                    5. Taylor expanded in M around 0

                      \[\leadsto \mathsf{/.f64}\left(\color{blue}{1}, \mathsf{+.f64}\left(1, \ell\right)\right) \]
                    6. Step-by-step derivation
                      1. Simplified6.0%

                        \[\leadsto \frac{\color{blue}{1}}{1 + \ell} \]
                      2. Final simplification6.0%

                        \[\leadsto \frac{1}{\ell + 1} \]
                      3. Add Preprocessing

                      Alternative 10: 6.6% 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 74.8%

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

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

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

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

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

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

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

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

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

                        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos \left(\mathsf{neg}\left(M\right)\right)}, \mathsf{exp.f64}\left(\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right) \]
                      6. Step-by-step derivation
                        1. cos-negN/A

                          \[\leadsto \mathsf{/.f64}\left(\cos M, \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                        2. cos-lowering-cos.f6497.4%

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\color{blue}{\mathsf{\_.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \ell\right), \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)}\right)\right) \]
                      7. Simplified97.4%

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

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

                          \[\leadsto \mathsf{/.f64}\left(\mathsf{cos.f64}\left(M\right), \mathsf{exp.f64}\left(\mathsf{*.f64}\left(\frac{1}{4}, \left({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.7%

                          \[\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) \]
                      10. Simplified57.7%

                        \[\leadsto \frac{\cos M}{e^{\color{blue}{0.25 \cdot \left(m \cdot m\right)}}} \]
                      11. Taylor expanded in M around 0

                        \[\leadsto \color{blue}{\frac{1}{e^{\frac{1}{4} \cdot {m}^{2}}}} \]
                      12. Step-by-step derivation
                        1. rec-expN/A

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

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

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

                          \[\leadsto \mathsf{exp.f64}\left(\left({m}^{2} \cdot \left(\mathsf{neg}\left(\frac{1}{4}\right)\right)\right)\right) \]
                        5. metadata-evalN/A

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

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

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

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

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

                        \[\leadsto \color{blue}{1} \]
                      15. Step-by-step derivation
                        1. Simplified4.7%

                          \[\leadsto \color{blue}{1} \]
                        2. Add Preprocessing

                        Reproduce

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