
(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:
Herbie found 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(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}
(FPCore (K m n M l) :precision binary64 (* (exp (- (fabs (- n m)) (+ (pow (fma (+ n m) 0.5 (- M)) 2.0) l))) (cos M)))
double code(double K, double m, double n, double M, double l) {
return exp((fabs((n - m)) - (pow(fma((n + m), 0.5, -M), 2.0) + l))) * cos(M);
}
function code(K, m, n, M, l) return Float64(exp(Float64(abs(Float64(n - m)) - Float64((fma(Float64(n + m), 0.5, Float64(-M)) ^ 2.0) + l))) * cos(M)) end
code[K_, m_, n_, M_, l_] := N[(N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(N[Power[N[(N[(n + m), $MachinePrecision] * 0.5 + (-M)), $MachinePrecision], 2.0], $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\left|n - m\right| - \left({\left(\mathsf{fma}\left(n + m, 0.5, -M\right)\right)}^{2} + \ell\right)} \cdot \cos M
\end{array}
Initial program 71.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Final simplification96.3%
(FPCore (K m n M l) :precision binary64 (* (pow (exp (- (- (- (fabs (- n m)) l) (pow (fma (+ n m) 0.5 (- M)) 2.0)))) -1.0) 1.0))
double code(double K, double m, double n, double M, double l) {
return pow(exp(-((fabs((n - m)) - l) - pow(fma((n + m), 0.5, -M), 2.0))), -1.0) * 1.0;
}
function code(K, m, n, M, l) return Float64((exp(Float64(-Float64(Float64(abs(Float64(n - m)) - l) - (fma(Float64(n + m), 0.5, Float64(-M)) ^ 2.0)))) ^ -1.0) * 1.0) end
code[K_, m_, n_, M_, l_] := N[(N[Power[N[Exp[(-N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(n + m), $MachinePrecision] * 0.5 + (-M)), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision])], $MachinePrecision], -1.0], $MachinePrecision] * 1.0), $MachinePrecision]
\begin{array}{l}
\\
{\left(e^{-\left(\left(\left|n - m\right| - \ell\right) - {\left(\mathsf{fma}\left(n + m, 0.5, -M\right)\right)}^{2}\right)}\right)}^{-1} \cdot 1
\end{array}
Initial program 71.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Applied rewrites96.3%
Taylor expanded in M around 0
Applied rewrites95.9%
Final simplification95.9%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fma (* M M) -0.5 1.0))
(t_1 (fabs (- n m)))
(t_2 (* (pow (exp (- (- (- t_1 l) (* M M)))) -1.0) 1.0))
(t_3 (* (exp (- t_1 (+ (* (* m m) 0.25) l))) t_0)))
(if (<= M -6.5e+109)
t_2
(if (<= M -7.5e-194)
t_3
(if (<= M 1.35e-145)
(* (exp (* (* n n) -0.25)) t_0)
(if (<= M 27.0)
t_3
(if (<= M 5.4e+106) (* (exp (* (- M) M)) t_0) t_2)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fma((M * M), -0.5, 1.0);
double t_1 = fabs((n - m));
double t_2 = pow(exp(-((t_1 - l) - (M * M))), -1.0) * 1.0;
double t_3 = exp((t_1 - (((m * m) * 0.25) + l))) * t_0;
double tmp;
if (M <= -6.5e+109) {
tmp = t_2;
} else if (M <= -7.5e-194) {
tmp = t_3;
} else if (M <= 1.35e-145) {
tmp = exp(((n * n) * -0.25)) * t_0;
} else if (M <= 27.0) {
tmp = t_3;
} else if (M <= 5.4e+106) {
tmp = exp((-M * M)) * t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = fma(Float64(M * M), -0.5, 1.0) t_1 = abs(Float64(n - m)) t_2 = Float64((exp(Float64(-Float64(Float64(t_1 - l) - Float64(M * M)))) ^ -1.0) * 1.0) t_3 = Float64(exp(Float64(t_1 - Float64(Float64(Float64(m * m) * 0.25) + l))) * t_0) tmp = 0.0 if (M <= -6.5e+109) tmp = t_2; elseif (M <= -7.5e-194) tmp = t_3; elseif (M <= 1.35e-145) tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * t_0); elseif (M <= 27.0) tmp = t_3; elseif (M <= 5.4e+106) tmp = Float64(exp(Float64(Float64(-M) * M)) * t_0); else tmp = t_2; end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(M * M), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[Exp[(-N[(N[(t$95$1 - l), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision])], $MachinePrecision], -1.0], $MachinePrecision] * 1.0), $MachinePrecision]}, Block[{t$95$3 = N[(N[Exp[N[(t$95$1 - N[(N[(N[(m * m), $MachinePrecision] * 0.25), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[M, -6.5e+109], t$95$2, If[LessEqual[M, -7.5e-194], t$95$3, If[LessEqual[M, 1.35e-145], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[M, 27.0], t$95$3, If[LessEqual[M, 5.4e+106], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], t$95$2]]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(M \cdot M, -0.5, 1\right)\\
t_1 := \left|n - m\right|\\
t_2 := {\left(e^{-\left(\left(t\_1 - \ell\right) - M \cdot M\right)}\right)}^{-1} \cdot 1\\
t_3 := e^{t\_1 - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot t\_0\\
\mathbf{if}\;M \leq -6.5 \cdot 10^{+109}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;M \leq -7.5 \cdot 10^{-194}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;M \leq 1.35 \cdot 10^{-145}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot t\_0\\
\mathbf{elif}\;M \leq 27:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;M \leq 5.4 \cdot 10^{+106}:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if M < -6.5e109 or 5.40000000000000012e106 < M Initial program 71.8%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in M around 0
Applied rewrites100.0%
Taylor expanded in M around inf
Applied rewrites100.0%
if -6.5e109 < M < -7.4999999999999998e-194 or 1.35e-145 < M < 27Initial program 76.4%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.9%
Taylor expanded in M around 0
Applied rewrites94.0%
Taylor expanded in m around inf
Applied rewrites59.7%
if -7.4999999999999998e-194 < M < 1.35e-145Initial program 61.6%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.6%
Taylor expanded in M around 0
Applied rewrites96.6%
Taylor expanded in n around inf
Applied rewrites61.3%
if 27 < M < 5.40000000000000012e106Initial program 71.4%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in M around 0
Applied rewrites100.0%
Taylor expanded in M around inf
Applied rewrites95.3%
Final simplification76.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (pow (exp (- (- (- (fabs (- n m)) l) (* M M)))) -1.0) 1.0))
(t_1 (fma (* M M) -0.5 1.0))
(t_2 (* (exp (* (- M) M)) t_1)))
(if (<= M -2e+151)
t_0
(if (<= M -0.0017)
t_2
(if (<= M -1e-183)
(* (exp (* (* m m) -0.25)) t_1)
(if (<= M 0.0082)
(* (exp (* (* n n) -0.25)) t_1)
(if (<= M 5.4e+106) t_2 t_0)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = pow(exp(-((fabs((n - m)) - l) - (M * M))), -1.0) * 1.0;
double t_1 = fma((M * M), -0.5, 1.0);
double t_2 = exp((-M * M)) * t_1;
double tmp;
if (M <= -2e+151) {
tmp = t_0;
} else if (M <= -0.0017) {
tmp = t_2;
} else if (M <= -1e-183) {
tmp = exp(((m * m) * -0.25)) * t_1;
} else if (M <= 0.0082) {
tmp = exp(((n * n) * -0.25)) * t_1;
} else if (M <= 5.4e+106) {
tmp = t_2;
} else {
tmp = t_0;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = Float64((exp(Float64(-Float64(Float64(abs(Float64(n - m)) - l) - Float64(M * M)))) ^ -1.0) * 1.0) t_1 = fma(Float64(M * M), -0.5, 1.0) t_2 = Float64(exp(Float64(Float64(-M) * M)) * t_1) tmp = 0.0 if (M <= -2e+151) tmp = t_0; elseif (M <= -0.0017) tmp = t_2; elseif (M <= -1e-183) tmp = Float64(exp(Float64(Float64(m * m) * -0.25)) * t_1); elseif (M <= 0.0082) tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * t_1); elseif (M <= 5.4e+106) tmp = t_2; else tmp = t_0; end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Power[N[Exp[(-N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision])], $MachinePrecision], -1.0], $MachinePrecision] * 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(M * M), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]}, Block[{t$95$2 = N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision]}, If[LessEqual[M, -2e+151], t$95$0, If[LessEqual[M, -0.0017], t$95$2, If[LessEqual[M, -1e-183], N[(N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[M, 0.0082], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[M, 5.4e+106], t$95$2, t$95$0]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := {\left(e^{-\left(\left(\left|n - m\right| - \ell\right) - M \cdot M\right)}\right)}^{-1} \cdot 1\\
t_1 := \mathsf{fma}\left(M \cdot M, -0.5, 1\right)\\
t_2 := e^{\left(-M\right) \cdot M} \cdot t\_1\\
\mathbf{if}\;M \leq -2 \cdot 10^{+151}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq -0.0017:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;M \leq -1 \cdot 10^{-183}:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25} \cdot t\_1\\
\mathbf{elif}\;M \leq 0.0082:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot t\_1\\
\mathbf{elif}\;M \leq 5.4 \cdot 10^{+106}:\\
\;\;\;\;t\_2\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -2.00000000000000003e151 or 5.40000000000000012e106 < M Initial program 73.6%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in M around 0
Applied rewrites100.0%
Taylor expanded in M around inf
Applied rewrites100.0%
if -2.00000000000000003e151 < M < -0.00169999999999999991 or 0.00820000000000000069 < M < 5.40000000000000012e106Initial program 68.3%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.7%
Taylor expanded in M around 0
Applied rewrites100.0%
Taylor expanded in M around inf
Applied rewrites91.8%
if -0.00169999999999999991 < M < -1.00000000000000001e-183Initial program 85.4%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.3%
Taylor expanded in M around 0
Applied rewrites91.3%
Taylor expanded in m around inf
Applied rewrites47.6%
if -1.00000000000000001e-183 < M < 0.00820000000000000069Initial program 64.0%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.3%
Taylor expanded in M around 0
Applied rewrites95.3%
Taylor expanded in n around inf
Applied rewrites61.4%
Final simplification77.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))) (t_1 (- (* 0.5 n) M)))
(if (<= m -1.55e-6)
(exp (- t_0 (fma 0.25 (pow (+ n m) 2.0) l)))
(* (pow (exp (- (- (- t_0 l) (* t_1 (+ m t_1))))) -1.0) 1.0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double t_1 = (0.5 * n) - M;
double tmp;
if (m <= -1.55e-6) {
tmp = exp((t_0 - fma(0.25, pow((n + m), 2.0), l)));
} else {
tmp = pow(exp(-((t_0 - l) - (t_1 * (m + t_1)))), -1.0) * 1.0;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) t_1 = Float64(Float64(0.5 * n) - M) tmp = 0.0 if (m <= -1.55e-6) tmp = exp(Float64(t_0 - fma(0.25, (Float64(n + m) ^ 2.0), l))); else tmp = Float64((exp(Float64(-Float64(Float64(t_0 - l) - Float64(t_1 * Float64(m + t_1))))) ^ -1.0) * 1.0); end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * n), $MachinePrecision] - M), $MachinePrecision]}, If[LessEqual[m, -1.55e-6], N[Exp[N[(t$95$0 - N[(0.25 * N[Power[N[(n + m), $MachinePrecision], 2.0], $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Power[N[Exp[(-N[(N[(t$95$0 - l), $MachinePrecision] - N[(t$95$1 * N[(m + t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])], $MachinePrecision], -1.0], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
t_1 := 0.5 \cdot n - M\\
\mathbf{if}\;m \leq -1.55 \cdot 10^{-6}:\\
\;\;\;\;e^{t\_0 - \mathsf{fma}\left(0.25, {\left(n + m\right)}^{2}, \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{-\left(\left(t\_0 - \ell\right) - t\_1 \cdot \left(m + t\_1\right)\right)}\right)}^{-1} \cdot 1\\
\end{array}
\end{array}
if m < -1.55e-6Initial program 63.4%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.2%
Taylor expanded in M around 0
Applied rewrites95.8%
if -1.55e-6 < m Initial program 74.1%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.0%
Applied rewrites96.0%
Taylor expanded in M around 0
Applied rewrites96.0%
Taylor expanded in m around 0
Applied rewrites84.8%
Final simplification87.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (* 0.5 n) M)))
(if (<= m -610.0)
(* (exp (* (* m m) -0.25)) (cos M))
(* (pow (exp (- (- (- (fabs (- n m)) l) (* t_0 (+ m t_0))))) -1.0) 1.0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (0.5 * n) - M;
double tmp;
if (m <= -610.0) {
tmp = exp(((m * m) * -0.25)) * cos(M);
} else {
tmp = pow(exp(-((fabs((n - m)) - l) - (t_0 * (m + t_0)))), -1.0) * 1.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 = (0.5d0 * n) - m_1
if (m <= (-610.0d0)) then
tmp = exp(((m * m) * (-0.25d0))) * cos(m_1)
else
tmp = (exp(-((abs((n - m)) - l) - (t_0 * (m + t_0)))) ** (-1.0d0)) * 1.0d0
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (0.5 * n) - M;
double tmp;
if (m <= -610.0) {
tmp = Math.exp(((m * m) * -0.25)) * Math.cos(M);
} else {
tmp = Math.pow(Math.exp(-((Math.abs((n - m)) - l) - (t_0 * (m + t_0)))), -1.0) * 1.0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (0.5 * n) - M tmp = 0 if m <= -610.0: tmp = math.exp(((m * m) * -0.25)) * math.cos(M) else: tmp = math.pow(math.exp(-((math.fabs((n - m)) - l) - (t_0 * (m + t_0)))), -1.0) * 1.0 return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(0.5 * n) - M) tmp = 0.0 if (m <= -610.0) tmp = Float64(exp(Float64(Float64(m * m) * -0.25)) * cos(M)); else tmp = Float64((exp(Float64(-Float64(Float64(abs(Float64(n - m)) - l) - Float64(t_0 * Float64(m + t_0))))) ^ -1.0) * 1.0); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (0.5 * n) - M; tmp = 0.0; if (m <= -610.0) tmp = exp(((m * m) * -0.25)) * cos(M); else tmp = (exp(-((abs((n - m)) - l) - (t_0 * (m + t_0)))) ^ -1.0) * 1.0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(0.5 * n), $MachinePrecision] - M), $MachinePrecision]}, If[LessEqual[m, -610.0], N[(N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[(-N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(t$95$0 * N[(m + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])], $MachinePrecision], -1.0], $MachinePrecision] * 1.0), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot n - M\\
\mathbf{if}\;m \leq -610:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25} \cdot \cos M\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{-\left(\left(\left|n - m\right| - \ell\right) - t\_0 \cdot \left(m + t\_0\right)\right)}\right)}^{-1} \cdot 1\\
\end{array}
\end{array}
if m < -610Initial program 63.2%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites98.5%
Taylor expanded in m around inf
Applied rewrites95.7%
if -610 < m Initial program 74.0%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.5%
Applied rewrites95.5%
Taylor expanded in M around 0
Applied rewrites95.5%
Taylor expanded in m around 0
Applied rewrites84.5%
Final simplification87.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (* 0.5 n) M)) (t_1 (fabs (- n m))))
(if (<= m -8.6e+95)
(* (exp (- t_1 (+ (* (* m m) 0.25) l))) (fma (* M M) -0.5 1.0))
(* (pow (exp (- (- (- t_1 l) (* t_0 (+ m t_0))))) -1.0) 1.0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (0.5 * n) - M;
double t_1 = fabs((n - m));
double tmp;
if (m <= -8.6e+95) {
tmp = exp((t_1 - (((m * m) * 0.25) + l))) * fma((M * M), -0.5, 1.0);
} else {
tmp = pow(exp(-((t_1 - l) - (t_0 * (m + t_0)))), -1.0) * 1.0;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = Float64(Float64(0.5 * n) - M) t_1 = abs(Float64(n - m)) tmp = 0.0 if (m <= -8.6e+95) tmp = Float64(exp(Float64(t_1 - Float64(Float64(Float64(m * m) * 0.25) + l))) * fma(Float64(M * M), -0.5, 1.0)); else tmp = Float64((exp(Float64(-Float64(Float64(t_1 - l) - Float64(t_0 * Float64(m + t_0))))) ^ -1.0) * 1.0); end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(0.5 * n), $MachinePrecision] - M), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -8.6e+95], N[(N[Exp[N[(t$95$1 - N[(N[(N[(m * m), $MachinePrecision] * 0.25), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[(N[(M * M), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]), $MachinePrecision], N[(N[Power[N[Exp[(-N[(N[(t$95$1 - l), $MachinePrecision] - N[(t$95$0 * N[(m + t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision])], $MachinePrecision], -1.0], $MachinePrecision] * 1.0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot n - M\\
t_1 := \left|n - m\right|\\
\mathbf{if}\;m \leq -8.6 \cdot 10^{+95}:\\
\;\;\;\;e^{t\_1 - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot \mathsf{fma}\left(M \cdot M, -0.5, 1\right)\\
\mathbf{else}:\\
\;\;\;\;{\left(e^{-\left(\left(t\_1 - \ell\right) - t\_0 \cdot \left(m + t\_0\right)\right)}\right)}^{-1} \cdot 1\\
\end{array}
\end{array}
if m < -8.6e95Initial program 58.7%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in M around 0
Applied rewrites76.1%
Taylor expanded in m around inf
Applied rewrites71.8%
if -8.6e95 < m Initial program 73.9%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.5%
Applied rewrites95.5%
Taylor expanded in M around 0
Applied rewrites95.0%
Taylor expanded in m around 0
Applied rewrites83.3%
Final simplification81.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fma (* M M) -0.5 1.0))
(t_1 (fabs (- n m)))
(t_2 (* (pow (exp (- (- (- t_1 l) (* M M)))) -1.0) 1.0)))
(if (<= M -6.5e+109)
t_2
(if (<= M -2e-211)
(* (exp (- t_1 (+ (* (* m m) 0.25) l))) t_0)
(if (<= M 0.0082)
(* (exp (- t_1 (+ (* (* n n) 0.25) l))) t_0)
(if (<= M 5.4e+106) (* (exp (* (- M) M)) t_0) t_2))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fma((M * M), -0.5, 1.0);
double t_1 = fabs((n - m));
double t_2 = pow(exp(-((t_1 - l) - (M * M))), -1.0) * 1.0;
double tmp;
if (M <= -6.5e+109) {
tmp = t_2;
} else if (M <= -2e-211) {
tmp = exp((t_1 - (((m * m) * 0.25) + l))) * t_0;
} else if (M <= 0.0082) {
tmp = exp((t_1 - (((n * n) * 0.25) + l))) * t_0;
} else if (M <= 5.4e+106) {
tmp = exp((-M * M)) * t_0;
} else {
tmp = t_2;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = fma(Float64(M * M), -0.5, 1.0) t_1 = abs(Float64(n - m)) t_2 = Float64((exp(Float64(-Float64(Float64(t_1 - l) - Float64(M * M)))) ^ -1.0) * 1.0) tmp = 0.0 if (M <= -6.5e+109) tmp = t_2; elseif (M <= -2e-211) tmp = Float64(exp(Float64(t_1 - Float64(Float64(Float64(m * m) * 0.25) + l))) * t_0); elseif (M <= 0.0082) tmp = Float64(exp(Float64(t_1 - Float64(Float64(Float64(n * n) * 0.25) + l))) * t_0); elseif (M <= 5.4e+106) tmp = Float64(exp(Float64(Float64(-M) * M)) * t_0); else tmp = t_2; end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(M * M), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[Power[N[Exp[(-N[(N[(t$95$1 - l), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision])], $MachinePrecision], -1.0], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[M, -6.5e+109], t$95$2, If[LessEqual[M, -2e-211], N[(N[Exp[N[(t$95$1 - N[(N[(N[(m * m), $MachinePrecision] * 0.25), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[M, 0.0082], N[(N[Exp[N[(t$95$1 - N[(N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[M, 5.4e+106], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], t$95$2]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(M \cdot M, -0.5, 1\right)\\
t_1 := \left|n - m\right|\\
t_2 := {\left(e^{-\left(\left(t\_1 - \ell\right) - M \cdot M\right)}\right)}^{-1} \cdot 1\\
\mathbf{if}\;M \leq -6.5 \cdot 10^{+109}:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;M \leq -2 \cdot 10^{-211}:\\
\;\;\;\;e^{t\_1 - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot t\_0\\
\mathbf{elif}\;M \leq 0.0082:\\
\;\;\;\;e^{t\_1 - \left(\left(n \cdot n\right) \cdot 0.25 + \ell\right)} \cdot t\_0\\
\mathbf{elif}\;M \leq 5.4 \cdot 10^{+106}:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if M < -6.5e109 or 5.40000000000000012e106 < M Initial program 71.8%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in M around 0
Applied rewrites100.0%
Taylor expanded in M around inf
Applied rewrites100.0%
if -6.5e109 < M < -2.00000000000000017e-211Initial program 78.0%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.8%
Taylor expanded in M around 0
Applied rewrites94.8%
Taylor expanded in m around inf
Applied rewrites61.5%
if -2.00000000000000017e-211 < M < 0.00820000000000000069Initial program 64.3%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites95.2%
Taylor expanded in M around 0
Applied rewrites95.2%
Taylor expanded in n around inf
Applied rewrites68.2%
if 0.00820000000000000069 < M < 5.40000000000000012e106Initial program 72.7%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in M around 0
Applied rewrites100.0%
Taylor expanded in M around inf
Applied rewrites91.1%
Final simplification78.9%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fma (* M M) -0.5 1.0))
(t_1 (- (* 0.5 n) M))
(t_2 (fabs (- n m)))
(t_3 (* (pow (exp (- (- (- t_2 l) (* M M)))) -1.0) 1.0)))
(if (<= M -6.5e+109)
t_3
(if (<= M -5e-184)
(* (exp (- t_2 (+ (* (* m m) 0.25) l))) t_0)
(if (<= M 4.9e+106)
(* (exp (- t_2 (+ (* t_1 (+ m t_1)) l))) t_0)
t_3)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fma((M * M), -0.5, 1.0);
double t_1 = (0.5 * n) - M;
double t_2 = fabs((n - m));
double t_3 = pow(exp(-((t_2 - l) - (M * M))), -1.0) * 1.0;
double tmp;
if (M <= -6.5e+109) {
tmp = t_3;
} else if (M <= -5e-184) {
tmp = exp((t_2 - (((m * m) * 0.25) + l))) * t_0;
} else if (M <= 4.9e+106) {
tmp = exp((t_2 - ((t_1 * (m + t_1)) + l))) * t_0;
} else {
tmp = t_3;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = fma(Float64(M * M), -0.5, 1.0) t_1 = Float64(Float64(0.5 * n) - M) t_2 = abs(Float64(n - m)) t_3 = Float64((exp(Float64(-Float64(Float64(t_2 - l) - Float64(M * M)))) ^ -1.0) * 1.0) tmp = 0.0 if (M <= -6.5e+109) tmp = t_3; elseif (M <= -5e-184) tmp = Float64(exp(Float64(t_2 - Float64(Float64(Float64(m * m) * 0.25) + l))) * t_0); elseif (M <= 4.9e+106) tmp = Float64(exp(Float64(t_2 - Float64(Float64(t_1 * Float64(m + t_1)) + l))) * t_0); else tmp = t_3; end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(M * M), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[(0.5 * n), $MachinePrecision] - M), $MachinePrecision]}, Block[{t$95$2 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$3 = N[(N[Power[N[Exp[(-N[(N[(t$95$2 - l), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision])], $MachinePrecision], -1.0], $MachinePrecision] * 1.0), $MachinePrecision]}, If[LessEqual[M, -6.5e+109], t$95$3, If[LessEqual[M, -5e-184], N[(N[Exp[N[(t$95$2 - N[(N[(N[(m * m), $MachinePrecision] * 0.25), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[M, 4.9e+106], N[(N[Exp[N[(t$95$2 - N[(N[(t$95$1 * N[(m + t$95$1), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], t$95$3]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(M \cdot M, -0.5, 1\right)\\
t_1 := 0.5 \cdot n - M\\
t_2 := \left|n - m\right|\\
t_3 := {\left(e^{-\left(\left(t\_2 - \ell\right) - M \cdot M\right)}\right)}^{-1} \cdot 1\\
\mathbf{if}\;M \leq -6.5 \cdot 10^{+109}:\\
\;\;\;\;t\_3\\
\mathbf{elif}\;M \leq -5 \cdot 10^{-184}:\\
\;\;\;\;e^{t\_2 - \left(\left(m \cdot m\right) \cdot 0.25 + \ell\right)} \cdot t\_0\\
\mathbf{elif}\;M \leq 4.9 \cdot 10^{+106}:\\
\;\;\;\;e^{t\_2 - \left(t\_1 \cdot \left(m + t\_1\right) + \ell\right)} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_3\\
\end{array}
\end{array}
if M < -6.5e109 or 4.89999999999999998e106 < M Initial program 71.8%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Applied rewrites100.0%
Taylor expanded in M around 0
Applied rewrites100.0%
Taylor expanded in M around inf
Applied rewrites100.0%
if -6.5e109 < M < -5.00000000000000003e-184Initial program 78.8%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites91.6%
Taylor expanded in M around 0
Applied rewrites94.6%
Taylor expanded in m around inf
Applied rewrites61.8%
if -5.00000000000000003e-184 < M < 4.89999999999999998e106Initial program 65.8%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.3%
Taylor expanded in M around 0
Applied rewrites96.3%
Taylor expanded in m around 0
Applied rewrites72.9%
Final simplification79.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fma (* M M) -0.5 1.0)) (t_1 (* (exp (* (* m m) -0.25)) t_0)))
(if (<= m -2e+48)
t_1
(if (<= m -2.4e-219)
(* 1.0 (exp (- l)))
(if (<= m 8e-22) (* (exp (* (- M) M)) t_0) t_1)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fma((M * M), -0.5, 1.0);
double t_1 = exp(((m * m) * -0.25)) * t_0;
double tmp;
if (m <= -2e+48) {
tmp = t_1;
} else if (m <= -2.4e-219) {
tmp = 1.0 * exp(-l);
} else if (m <= 8e-22) {
tmp = exp((-M * M)) * t_0;
} else {
tmp = t_1;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = fma(Float64(M * M), -0.5, 1.0) t_1 = Float64(exp(Float64(Float64(m * m) * -0.25)) * t_0) tmp = 0.0 if (m <= -2e+48) tmp = t_1; elseif (m <= -2.4e-219) tmp = Float64(1.0 * exp(Float64(-l))); elseif (m <= 8e-22) tmp = Float64(exp(Float64(Float64(-M) * M)) * t_0); else tmp = t_1; end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(M * M), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[(N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[m, -2e+48], t$95$1, If[LessEqual[m, -2.4e-219], N[(1.0 * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 8e-22], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], t$95$1]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(M \cdot M, -0.5, 1\right)\\
t_1 := e^{\left(m \cdot m\right) \cdot -0.25} \cdot t\_0\\
\mathbf{if}\;m \leq -2 \cdot 10^{+48}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;m \leq -2.4 \cdot 10^{-219}:\\
\;\;\;\;1 \cdot e^{-\ell}\\
\mathbf{elif}\;m \leq 8 \cdot 10^{-22}:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if m < -2.00000000000000009e48 or 8.0000000000000004e-22 < m Initial program 64.3%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites99.9%
Taylor expanded in M around 0
Applied rewrites76.2%
Taylor expanded in m around inf
Applied rewrites71.4%
if -2.00000000000000009e48 < m < -2.40000000000000014e-219Initial program 73.0%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6432.1
Applied rewrites32.1%
Taylor expanded in K around 0
cos-neg-revN/A
lower-cos.f6437.6
Applied rewrites37.6%
Taylor expanded in M around 0
Applied rewrites36.1%
if -2.40000000000000014e-219 < m < 8.0000000000000004e-22Initial program 80.3%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites93.9%
Taylor expanded in M around 0
Applied rewrites71.2%
Taylor expanded in M around inf
Applied rewrites36.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fma (* M M) -0.5 1.0)))
(if (<= m -2e+48)
(* (exp (* (* m m) -0.25)) t_0)
(if (<= m -2.1e-218)
(* 1.0 (exp (- l)))
(* (exp (* (* n n) -0.25)) t_0)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fma((M * M), -0.5, 1.0);
double tmp;
if (m <= -2e+48) {
tmp = exp(((m * m) * -0.25)) * t_0;
} else if (m <= -2.1e-218) {
tmp = 1.0 * exp(-l);
} else {
tmp = exp(((n * n) * -0.25)) * t_0;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = fma(Float64(M * M), -0.5, 1.0) tmp = 0.0 if (m <= -2e+48) tmp = Float64(exp(Float64(Float64(m * m) * -0.25)) * t_0); elseif (m <= -2.1e-218) tmp = Float64(1.0 * exp(Float64(-l))); else tmp = Float64(exp(Float64(Float64(n * n) * -0.25)) * t_0); end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(M * M), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]}, If[LessEqual[m, -2e+48], N[(N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[m, -2.1e-218], N[(1.0 * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(M \cdot M, -0.5, 1\right)\\
\mathbf{if}\;m \leq -2 \cdot 10^{+48}:\\
\;\;\;\;e^{\left(m \cdot m\right) \cdot -0.25} \cdot t\_0\\
\mathbf{elif}\;m \leq -2.1 \cdot 10^{-218}:\\
\;\;\;\;1 \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25} \cdot t\_0\\
\end{array}
\end{array}
if m < -2.00000000000000009e48Initial program 59.3%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites100.0%
Taylor expanded in M around 0
Applied rewrites77.8%
Taylor expanded in m around inf
Applied rewrites76.0%
if -2.00000000000000009e48 < m < -2.09999999999999994e-218Initial program 73.0%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6432.1
Applied rewrites32.1%
Taylor expanded in K around 0
cos-neg-revN/A
lower-cos.f6437.6
Applied rewrites37.6%
Taylor expanded in M around 0
Applied rewrites36.1%
if -2.09999999999999994e-218 < m Initial program 74.9%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites96.6%
Taylor expanded in M around 0
Applied rewrites72.9%
Taylor expanded in n around inf
Applied rewrites47.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fma (* M M) -0.5 1.0)) (t_1 (exp (- l))))
(if (<= l -1.7e+66)
(* t_0 t_1)
(if (<= l 4.3e-7) (* (exp (* (- M) M)) t_0) (* 1.0 t_1)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fma((M * M), -0.5, 1.0);
double t_1 = exp(-l);
double tmp;
if (l <= -1.7e+66) {
tmp = t_0 * t_1;
} else if (l <= 4.3e-7) {
tmp = exp((-M * M)) * t_0;
} else {
tmp = 1.0 * t_1;
}
return tmp;
}
function code(K, m, n, M, l) t_0 = fma(Float64(M * M), -0.5, 1.0) t_1 = exp(Float64(-l)) tmp = 0.0 if (l <= -1.7e+66) tmp = Float64(t_0 * t_1); elseif (l <= 4.3e-7) tmp = Float64(exp(Float64(Float64(-M) * M)) * t_0); else tmp = Float64(1.0 * t_1); end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(M * M), $MachinePrecision] * -0.5 + 1.0), $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[l, -1.7e+66], N[(t$95$0 * t$95$1), $MachinePrecision], If[LessEqual[l, 4.3e-7], N[(N[Exp[N[((-M) * M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], N[(1.0 * t$95$1), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \mathsf{fma}\left(M \cdot M, -0.5, 1\right)\\
t_1 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -1.7 \cdot 10^{+66}:\\
\;\;\;\;t\_0 \cdot t\_1\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-7}:\\
\;\;\;\;e^{\left(-M\right) \cdot M} \cdot t\_0\\
\mathbf{else}:\\
\;\;\;\;1 \cdot t\_1\\
\end{array}
\end{array}
if l < -1.70000000000000015e66Initial program 70.2%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6426.2
Applied rewrites26.2%
Taylor expanded in K around 0
cos-neg-revN/A
lower-cos.f6426.5
Applied rewrites26.5%
Taylor expanded in M around 0
Applied rewrites26.5%
if -1.70000000000000015e66 < l < 4.3000000000000001e-7Initial program 68.3%
Taylor expanded in K around 0
*-commutativeN/A
lower-*.f64N/A
Applied rewrites97.7%
Taylor expanded in M around 0
Applied rewrites69.9%
Taylor expanded in M around inf
Applied rewrites33.3%
if 4.3000000000000001e-7 < l Initial program 79.3%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6476.0
Applied rewrites76.0%
Taylor expanded in K around 0
cos-neg-revN/A
lower-cos.f6495.0
Applied rewrites95.0%
Taylor expanded in M around 0
Applied rewrites95.0%
(FPCore (K m n M l) :precision binary64 (* 1.0 (exp (- l))))
double code(double K, double m, double n, double M, double l) {
return 1.0 * exp(-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 = 1.0d0 * exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0 * Math.exp(-l);
}
def code(K, m, n, M, l): return 1.0 * math.exp(-l)
function code(K, m, n, M, l) return Float64(1.0 * exp(Float64(-l))) end
function tmp = code(K, m, n, M, l) tmp = 1.0 * exp(-l); end
code[K_, m_, n_, M_, l_] := N[(1.0 * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 \cdot e^{-\ell}
\end{array}
Initial program 71.1%
Taylor expanded in l around inf
mul-1-negN/A
lower-neg.f6426.7
Applied rewrites26.7%
Taylor expanded in K around 0
cos-neg-revN/A
lower-cos.f6431.7
Applied rewrites31.7%
Taylor expanded in M around 0
Applied rewrites31.4%
herbie shell --seed 2024340
(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)))))))