Maksimov and Kolovsky, Equation (32)

Percentage Accurate: 76.5% → 96.5%
Time: 17.9s
Alternatives: 10
Speedup: 1.9×

Specification

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

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

Sampling outcomes in binary64 precision:

Local Percentage Accuracy vs ?

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

Accuracy vs Speed?

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

\[\begin{array}{l} \\ \begin{array}{l} t_0 := \frac{m + n}{2} - M\\ \frac{\cos M}{e^{t\_0 \cdot t\_0 + \left(\ell - \left|m - n\right|\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(t_0 * t_0) + Float64(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[(t$95$0 * t$95$0), $MachinePrecision] + N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}

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

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

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

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

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

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

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

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

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

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

    \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
  6. Step-by-step derivation
    1. cos-lowering-cos.f6496.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
  7. Simplified96.3%

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

Alternative 2: 95.1% accurate, 1.9× speedup?

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

\\
\begin{array}{l}
t_0 := \frac{\cos M}{e^{M \cdot M}}\\
\mathbf{if}\;M \leq -2.2 \cdot 10^{+67}:\\
\;\;\;\;t\_0\\

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if M < -2.2e67 or 27 < M

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6499.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified99.2%

      \[\leadsto \frac{\color{blue}{\cos M}}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\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-*.f6496.9%

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

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

    if -2.2e67 < M < 27

    1. Initial program 73.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. Simplified73.1%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6493.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified93.4%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 3: 72.5% accurate, 1.9× speedup?

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

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

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

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


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

    1. Initial program 74.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. 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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -55 < m < -1.99999999999999992e-103

    1. Initial program 90.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. Simplified90.5%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6495.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified95.2%

      \[\leadsto \frac{\color{blue}{\cos M}}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\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-*.f6476.8%

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

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

    if -1.99999999999999992e-103 < m

    1. Initial program 76.8%

      \[\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)} \]
    2. Step-by-step derivation
      1. 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.8%

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

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

        \[\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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified94.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 4: 66.0% accurate, 2.0× speedup?

\[\begin{array}{l} \\ \begin{array}{l} \mathbf{if}\;m \leq -55:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq -1.5 \cdot 10^{-224}:\\ \;\;\;\;\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 (<= m -55.0)
   (exp (* -0.25 (* m m)))
   (if (<= m -1.5e-224)
     (/ (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 (m <= -55.0) {
		tmp = exp((-0.25 * (m * m)));
	} else if (m <= -1.5e-224) {
		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 (m <= (-55.0d0)) then
        tmp = exp(((-0.25d0) * (m * m)))
    else if (m <= (-1.5d-224)) 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 (m <= -55.0) {
		tmp = Math.exp((-0.25 * (m * m)));
	} else if (m <= -1.5e-224) {
		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 m <= -55.0:
		tmp = math.exp((-0.25 * (m * m)))
	elif m <= -1.5e-224:
		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 (m <= -55.0)
		tmp = exp(Float64(-0.25 * Float64(m * m)));
	elseif (m <= -1.5e-224)
		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 (m <= -55.0)
		tmp = exp((-0.25 * (m * m)));
	elseif (m <= -1.5e-224)
		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[m, -55.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.5e-224], 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}\;m \leq -55:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\

\mathbf{elif}\;m \leq -1.5 \cdot 10^{-224}:\\
\;\;\;\;\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 m < -55

    1. Initial program 74.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. 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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -55 < m < -1.49999999999999991e-224

    1. Initial program 84.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. Simplified84.1%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6492.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified92.3%

      \[\leadsto \frac{\color{blue}{\cos M}}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\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.2%

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

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

    if -1.49999999999999991e-224 < m

    1. Initial program 76.2%

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

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

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

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

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

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

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

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

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

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

        \[\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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified95.6%

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

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

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

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

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

      \[\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 5: 66.0% accurate, 2.0× speedup?

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

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

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

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


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

    1. Initial program 74.4%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. 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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -55 < m < -1.25e-224

    1. Initial program 84.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. Simplified84.1%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6492.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified92.3%

      \[\leadsto \frac{\color{blue}{\cos M}}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\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.2%

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

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

    if -1.25e-224 < m

    1. Initial program 76.2%

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

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

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

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

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

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

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

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

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

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

        \[\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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified95.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

Alternative 6: 69.3% accurate, 3.7× speedup?

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

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

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

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


\end{array}
\end{array}
Derivation
  1. Split input into 2 regimes
  2. if m < -4.30000000000000033e-6 or 6.6e-4 < m

    1. Initial program 73.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. Simplified73.5%

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6498.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified98.5%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    if -4.30000000000000033e-6 < m < 6.6e-4

    1. Initial program 81.3%

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6493.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified93.9%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{neg.f64}\left(\color{blue}{\ell}\right)\right) \]
    12. Step-by-step derivation
      1. Simplified38.9%

        \[\leadsto e^{-\color{blue}{\ell}} \]
    13. Recombined 2 regimes into one program.
    14. Final simplification68.8%

      \[\leadsto \begin{array}{l} \mathbf{if}\;m \leq -4.3 \cdot 10^{-6}:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \mathbf{elif}\;m \leq 0.00066:\\ \;\;\;\;e^{0 - \ell}\\ \mathbf{else}:\\ \;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\ \end{array} \]
    15. Add Preprocessing

    Alternative 7: 65.5% accurate, 3.9× speedup?

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

      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(M + \frac{K \cdot \left(m + n\right)}{-2}\right)}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\right)}}} \]
      4. Add Preprocessing
      5. Taylor expanded in K around 0

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. 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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
      7. Simplified100.0%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      if -2.0499999999999999e-6 < m

      1. Initial program 78.2%

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

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

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

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

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

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

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

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

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

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

          \[\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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
      7. Simplified94.6%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

    Alternative 8: 35.8% accurate, 4.1× speedup?

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
    6. Step-by-step derivation
      1. cos-lowering-cos.f6496.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
    7. Simplified96.3%

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

      \[\leadsto \mathsf{exp.f64}\left(\mathsf{neg.f64}\left(\color{blue}{\ell}\right)\right) \]
    12. Step-by-step derivation
      1. Simplified34.3%

        \[\leadsto e^{-\color{blue}{\ell}} \]
      2. Final simplification34.3%

        \[\leadsto e^{0 - \ell} \]
      3. Add Preprocessing

      Alternative 9: 6.6% accurate, 22.4× speedup?

      \[\begin{array}{l} \\ 1 + \left(M \cdot M\right) \cdot \left(\left(M \cdot M\right) \cdot \left(0.041666666666666664 + \left(M \cdot M\right) \cdot -0.001388888888888889\right) + -0.5\right) \end{array} \]
      (FPCore (K m n M l)
       :precision binary64
       (+
        1.0
        (*
         (* M M)
         (+
          (* (* M M) (+ 0.041666666666666664 (* (* M M) -0.001388888888888889)))
          -0.5))))
      double code(double K, double m, double n, double M, double l) {
      	return 1.0 + ((M * M) * (((M * M) * (0.041666666666666664 + ((M * M) * -0.001388888888888889))) + -0.5));
      }
      
      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 + ((m_1 * m_1) * (((m_1 * m_1) * (0.041666666666666664d0 + ((m_1 * m_1) * (-0.001388888888888889d0)))) + (-0.5d0)))
      end function
      
      public static double code(double K, double m, double n, double M, double l) {
      	return 1.0 + ((M * M) * (((M * M) * (0.041666666666666664 + ((M * M) * -0.001388888888888889))) + -0.5));
      }
      
      def code(K, m, n, M, l):
      	return 1.0 + ((M * M) * (((M * M) * (0.041666666666666664 + ((M * M) * -0.001388888888888889))) + -0.5))
      
      function code(K, m, n, M, l)
      	return Float64(1.0 + Float64(Float64(M * M) * Float64(Float64(Float64(M * M) * Float64(0.041666666666666664 + Float64(Float64(M * M) * -0.001388888888888889))) + -0.5)))
      end
      
      function tmp = code(K, m, n, M, l)
      	tmp = 1.0 + ((M * M) * (((M * M) * (0.041666666666666664 + ((M * M) * -0.001388888888888889))) + -0.5));
      end
      
      code[K_, m_, n_, M_, l_] := N[(1.0 + N[(N[(M * M), $MachinePrecision] * N[(N[(N[(M * M), $MachinePrecision] * N[(0.041666666666666664 + N[(N[(M * M), $MachinePrecision] * -0.001388888888888889), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
      
      \begin{array}{l}
      
      \\
      1 + \left(M \cdot M\right) \cdot \left(\left(M \cdot M\right) \cdot \left(0.041666666666666664 + \left(M \cdot M\right) \cdot -0.001388888888888889\right) + -0.5\right)
      \end{array}
      
      Derivation
      1. Initial program 77.2%

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

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

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

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

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

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

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

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

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

        \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
      6. Step-by-step derivation
        1. cos-lowering-cos.f6496.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
      7. Simplified96.3%

        \[\leadsto \frac{\color{blue}{\cos M}}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\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. Simplified35.4%

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

          \[\leadsto \color{blue}{\cos M} \]
        3. Step-by-step derivation
          1. cos-lowering-cos.f644.8%

            \[\leadsto \mathsf{cos.f64}\left(M\right) \]
        4. Simplified4.8%

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

          \[\leadsto \color{blue}{1 + {M}^{2} \cdot \left({M}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {M}^{2}\right) - \frac{1}{2}\right)} \]
        6. Step-by-step derivation
          1. +-lowering-+.f64N/A

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

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\left({M}^{2}\right), \color{blue}{\left({M}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {M}^{2}\right) - \frac{1}{2}\right)}\right)\right) \]
          3. unpow2N/A

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

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \left(\color{blue}{{M}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {M}^{2}\right)} - \frac{1}{2}\right)\right)\right) \]
          5. sub-negN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \left({M}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {M}^{2}\right) + \color{blue}{\left(\mathsf{neg}\left(\frac{1}{2}\right)\right)}\right)\right)\right) \]
          6. metadata-evalN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \left({M}^{2} \cdot \left(\frac{1}{24} + \frac{-1}{720} \cdot {M}^{2}\right) + \frac{-1}{2}\right)\right)\right) \]
          7. +-lowering-+.f64N/A

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

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left({M}^{2}\right), \left(\frac{1}{24} + \frac{-1}{720} \cdot {M}^{2}\right)\right), \frac{-1}{2}\right)\right)\right) \]
          9. unpow2N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\left(M \cdot M\right), \left(\frac{1}{24} + \frac{-1}{720} \cdot {M}^{2}\right)\right), \frac{-1}{2}\right)\right)\right) \]
          10. *-lowering-*.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \left(\frac{1}{24} + \frac{-1}{720} \cdot {M}^{2}\right)\right), \frac{-1}{2}\right)\right)\right) \]
          11. +-lowering-+.f64N/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\frac{1}{24}, \left(\frac{-1}{720} \cdot {M}^{2}\right)\right)\right), \frac{-1}{2}\right)\right)\right) \]
          12. *-commutativeN/A

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\frac{1}{24}, \left({M}^{2} \cdot \frac{-1}{720}\right)\right)\right), \frac{-1}{2}\right)\right)\right) \]
          13. *-lowering-*.f64N/A

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

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\left(M \cdot M\right), \frac{-1}{720}\right)\right)\right), \frac{-1}{2}\right)\right)\right) \]
          15. *-lowering-*.f645.2%

            \[\leadsto \mathsf{+.f64}\left(1, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \mathsf{+.f64}\left(\frac{1}{24}, \mathsf{*.f64}\left(\mathsf{*.f64}\left(M, M\right), \frac{-1}{720}\right)\right)\right), \frac{-1}{2}\right)\right)\right) \]
        7. Simplified5.2%

          \[\leadsto \color{blue}{1 + \left(M \cdot M\right) \cdot \left(\left(M \cdot M\right) \cdot \left(0.041666666666666664 + \left(M \cdot M\right) \cdot -0.001388888888888889\right) + -0.5\right)} \]
        8. Add Preprocessing

        Alternative 10: 6.9% accurate, 425.0× speedup?

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

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

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

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

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

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

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

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

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

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

          \[\leadsto \mathsf{/.f64}\left(\color{blue}{\cos M}, \mathsf{exp.f64}\left(\mathsf{+.f64}\left(\mathsf{*.f64}\left(\mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)\right)\right) \]
        6. Step-by-step derivation
          1. cos-lowering-cos.f6496.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(m, n\right), 2\right), M\right), \mathsf{\_.f64}\left(\mathsf{/.f64}\left(\mathsf{+.f64}\left(m, n\right), 2\right), M\right)\right), \mathsf{\_.f64}\left(\ell, \mathsf{fabs.f64}\left(\mathsf{\_.f64}\left(m, n\right)\right)\right)\right)}\right)\right) \]
        7. Simplified96.3%

          \[\leadsto \frac{\color{blue}{\cos M}}{e^{\left(\frac{m + n}{2} - M\right) \cdot \left(\frac{m + n}{2} - M\right) + \left(\ell - \left|m - n\right|\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. Simplified35.4%

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

            \[\leadsto \color{blue}{\cos M} \]
          3. Step-by-step derivation
            1. cos-lowering-cos.f644.8%

              \[\leadsto \mathsf{cos.f64}\left(M\right) \]
          4. Simplified4.8%

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

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

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

            Reproduce

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