
(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 16 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}
NOTE: m and n should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- m n))))
(if (<= n 20.0)
(*
(cos M)
(exp
(+
(- t_0 l)
(- (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) (* (* n n) 0.25)))))
(exp (- t_0 (+ l (* 0.25 (pow (+ m n) 2.0))))))))assert(m < n);
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n));
double tmp;
if (n <= 20.0) {
tmp = cos(M) * exp(((t_0 - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
} else {
tmp = exp((t_0 - (l + (0.25 * pow((m + n), 2.0)))));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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 = abs((m - n))
if (n <= 20.0d0) then
tmp = cos(m_1) * exp(((t_0 - l) + (((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) - ((n * n) * 0.25d0))))
else
tmp = exp((t_0 - (l + (0.25d0 * ((m + n) ** 2.0d0)))))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.abs((m - n));
double tmp;
if (n <= 20.0) {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
} else {
tmp = Math.exp((t_0 - (l + (0.25 * Math.pow((m + n), 2.0)))));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): t_0 = math.fabs((m - n)) tmp = 0 if n <= 20.0: tmp = math.cos(M) * math.exp(((t_0 - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25)))) else: tmp = math.exp((t_0 - (l + (0.25 * math.pow((m + n), 2.0))))) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) t_0 = abs(Float64(m - n)) tmp = 0.0 if (n <= 20.0) tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) - Float64(Float64(n * n) * 0.25))))); else tmp = exp(Float64(t_0 - Float64(l + Float64(0.25 * (Float64(m + n) ^ 2.0))))); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = abs((m - n));
tmp = 0.0;
if (n <= 20.0)
tmp = cos(M) * exp(((t_0 - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
else
tmp = exp((t_0 - (l + (0.25 * ((m + n) ^ 2.0)))));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, 20.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(N[(N[(n + N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(t$95$0 - N[(l + N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
t_0 := \left|m - n\right|\\
\mathbf{if}\;n \leq 20:\\
\;\;\;\;\cos M \cdot e^{\left(t_0 - \ell\right) + \left(\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) - \left(n \cdot n\right) \cdot 0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{t_0 - \left(\ell + 0.25 \cdot {\left(m + n\right)}^{2}\right)}\\
\end{array}
\end{array}
if n < 20Initial program 78.3%
*-commutative78.3%
associate-*r/78.3%
associate--r-78.3%
+-commutative78.3%
associate-+r-78.3%
unsub-neg78.3%
associate--r+78.3%
+-commutative78.3%
associate--r+78.3%
Simplified78.3%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Taylor expanded in n around 0 89.2%
associate-+r+89.2%
unpow289.2%
distribute-rgt-out94.7%
*-commutative94.7%
unpow294.7%
Simplified94.7%
if 20 < n Initial program 63.4%
*-commutative63.4%
associate-*r/63.4%
associate--r-63.4%
+-commutative63.4%
associate-+r-63.4%
unsub-neg63.4%
associate--r+63.4%
+-commutative63.4%
associate--r+63.4%
Simplified63.4%
Taylor expanded in K around 0 74.6%
cos-neg74.6%
associate-*r*74.6%
sin-neg74.6%
Simplified74.6%
Taylor expanded in M around 0 100.0%
Final simplification96.1%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
assert(m < n);
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
}
NOTE: m and n should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
m, n = sort([m, n]) function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
m, n = num2cell(sort([m, n])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0)));
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 74.1%
*-commutative74.1%
associate-*r/74.1%
associate--r-74.1%
+-commutative74.1%
associate-+r-74.1%
unsub-neg74.1%
associate--r+74.1%
+-commutative74.1%
associate--r+74.1%
Simplified74.1%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Final simplification97.3%
NOTE: m and n should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- m n))))
(if (<= n 10000.0)
(exp
(+
(- t_0 l)
(- (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) (* (* n n) 0.25))))
(exp (- t_0 (+ l (* 0.25 (pow (+ m n) 2.0))))))))assert(m < n);
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n));
double tmp;
if (n <= 10000.0) {
tmp = exp(((t_0 - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
} else {
tmp = exp((t_0 - (l + (0.25 * pow((m + n), 2.0)))));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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 = abs((m - n))
if (n <= 10000.0d0) then
tmp = exp(((t_0 - l) + (((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) - ((n * n) * 0.25d0))))
else
tmp = exp((t_0 - (l + (0.25d0 * ((m + n) ** 2.0d0)))))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.abs((m - n));
double tmp;
if (n <= 10000.0) {
tmp = Math.exp(((t_0 - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
} else {
tmp = Math.exp((t_0 - (l + (0.25 * Math.pow((m + n), 2.0)))));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): t_0 = math.fabs((m - n)) tmp = 0 if n <= 10000.0: tmp = math.exp(((t_0 - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25)))) else: tmp = math.exp((t_0 - (l + (0.25 * math.pow((m + n), 2.0))))) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) t_0 = abs(Float64(m - n)) tmp = 0.0 if (n <= 10000.0) tmp = exp(Float64(Float64(t_0 - l) + Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) - Float64(Float64(n * n) * 0.25)))); else tmp = exp(Float64(t_0 - Float64(l + Float64(0.25 * (Float64(m + n) ^ 2.0))))); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = abs((m - n));
tmp = 0.0;
if (n <= 10000.0)
tmp = exp(((t_0 - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
else
tmp = exp((t_0 - (l + (0.25 * ((m + n) ^ 2.0)))));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, 10000.0], N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(N[(N[(n + N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(t$95$0 - N[(l + N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
t_0 := \left|m - n\right|\\
\mathbf{if}\;n \leq 10000:\\
\;\;\;\;e^{\left(t_0 - \ell\right) + \left(\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) - \left(n \cdot n\right) \cdot 0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{t_0 - \left(\ell + 0.25 \cdot {\left(m + n\right)}^{2}\right)}\\
\end{array}
\end{array}
if n < 1e4Initial program 78.3%
*-commutative78.3%
associate-*r/78.3%
associate--r-78.3%
+-commutative78.3%
associate-+r-78.3%
unsub-neg78.3%
associate--r+78.3%
+-commutative78.3%
associate--r+78.3%
Simplified78.3%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Taylor expanded in n around 0 89.2%
associate-+r+89.2%
unpow289.2%
distribute-rgt-out94.7%
*-commutative94.7%
unpow294.7%
Simplified94.7%
Taylor expanded in M around 0 93.0%
if 1e4 < n Initial program 63.4%
*-commutative63.4%
associate-*r/63.4%
associate--r-63.4%
+-commutative63.4%
associate-+r-63.4%
unsub-neg63.4%
associate--r+63.4%
+-commutative63.4%
associate--r+63.4%
Simplified63.4%
Taylor expanded in K around 0 74.6%
cos-neg74.6%
associate-*r*74.6%
sin-neg74.6%
Simplified74.6%
Taylor expanded in M around 0 100.0%
Final simplification95.0%
NOTE: m and n should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= n 2e+106)
(exp
(+
(- (fabs (- m n)) l)
(- (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) (* (* n n) 0.25))))
(exp (* (* n n) -0.25))))assert(m < n);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2e+106) {
tmp = exp(((fabs((m - n)) - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
} else {
tmp = exp(((n * n) * -0.25));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 2d+106) then
tmp = exp(((abs((m - n)) - l) + (((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) - ((n * n) * 0.25d0))))
else
tmp = exp(((n * n) * (-0.25d0)))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2e+106) {
tmp = Math.exp(((Math.abs((m - n)) - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): tmp = 0 if n <= 2e+106: tmp = math.exp(((math.fabs((m - n)) - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25)))) else: tmp = math.exp(((n * n) * -0.25)) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) tmp = 0.0 if (n <= 2e+106) tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) + Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) - Float64(Float64(n * n) * 0.25)))); else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (n <= 2e+106)
tmp = exp(((abs((m - n)) - l) + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - ((n * n) * 0.25))));
else
tmp = exp(((n * n) * -0.25));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[n, 2e+106], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] + N[(N[(N[(n + N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
\mathbf{if}\;n \leq 2 \cdot 10^{+106}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) + \left(\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) - \left(n \cdot n\right) \cdot 0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if n < 2.00000000000000018e106Initial program 79.1%
*-commutative79.1%
associate-*r/79.1%
associate--r-79.1%
+-commutative79.1%
associate-+r-79.1%
unsub-neg79.1%
associate--r+79.1%
+-commutative79.1%
associate--r+79.1%
Simplified79.1%
Taylor expanded in K around 0 96.6%
cos-neg96.6%
Simplified96.6%
Taylor expanded in n around 0 89.9%
associate-+r+89.9%
unpow289.9%
distribute-rgt-out95.2%
*-commutative95.2%
unpow295.2%
Simplified95.2%
Taylor expanded in M around 0 93.8%
if 2.00000000000000018e106 < n Initial program 53.1%
*-commutative53.1%
associate-*r/53.1%
associate--r-53.1%
+-commutative53.1%
associate-+r-53.1%
unsub-neg53.1%
associate--r+53.1%
+-commutative53.1%
associate--r+53.1%
Simplified53.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 67.3%
associate-+r+67.3%
unpow267.3%
distribute-rgt-out75.5%
*-commutative75.5%
unpow275.5%
Simplified75.5%
Taylor expanded in M around 0 75.5%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification95.0%
NOTE: m and n should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* M (- M)))))
(if (<= M -2.0)
(* (cos M) t_0)
(if (<= M 2.35e+21)
(exp
(-
(- (fabs (- m n)) l)
(+ (* 0.5 (* m (+ n (* m 0.5)))) (* (* n n) 0.25))))
t_0))))assert(m < n);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((M * -M));
double tmp;
if (M <= -2.0) {
tmp = cos(M) * t_0;
} else if (M <= 2.35e+21) {
tmp = exp(((fabs((m - n)) - l) - ((0.5 * (m * (n + (m * 0.5)))) + ((n * n) * 0.25))));
} else {
tmp = t_0;
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = exp((m_1 * -m_1))
if (m_1 <= (-2.0d0)) then
tmp = cos(m_1) * t_0
else if (m_1 <= 2.35d+21) then
tmp = exp(((abs((m - n)) - l) - ((0.5d0 * (m * (n + (m * 0.5d0)))) + ((n * n) * 0.25d0))))
else
tmp = t_0
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp((M * -M));
double tmp;
if (M <= -2.0) {
tmp = Math.cos(M) * t_0;
} else if (M <= 2.35e+21) {
tmp = Math.exp(((Math.abs((m - n)) - l) - ((0.5 * (m * (n + (m * 0.5)))) + ((n * n) * 0.25))));
} else {
tmp = t_0;
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): t_0 = math.exp((M * -M)) tmp = 0 if M <= -2.0: tmp = math.cos(M) * t_0 elif M <= 2.35e+21: tmp = math.exp(((math.fabs((m - n)) - l) - ((0.5 * (m * (n + (m * 0.5)))) + ((n * n) * 0.25)))) else: tmp = t_0 return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) t_0 = exp(Float64(M * Float64(-M))) tmp = 0.0 if (M <= -2.0) tmp = Float64(cos(M) * t_0); elseif (M <= 2.35e+21) tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5)))) + Float64(Float64(n * n) * 0.25)))); else tmp = t_0; end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = exp((M * -M));
tmp = 0.0;
if (M <= -2.0)
tmp = cos(M) * t_0;
elseif (M <= 2.35e+21)
tmp = exp(((abs((m - n)) - l) - ((0.5 * (m * (n + (m * 0.5)))) + ((n * n) * 0.25))));
else
tmp = t_0;
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -2.0], N[(N[Cos[M], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[M, 2.35e+21], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], t$95$0]]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
t_0 := e^{M \cdot \left(-M\right)}\\
\mathbf{if}\;M \leq -2:\\
\;\;\;\;\cos M \cdot t_0\\
\mathbf{elif}\;M \leq 2.35 \cdot 10^{+21}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) - \left(0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right) + \left(n \cdot n\right) \cdot 0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0\\
\end{array}
\end{array}
if M < -2Initial program 84.5%
*-commutative84.5%
associate-*r/84.5%
associate--r-84.5%
+-commutative84.5%
associate-+r-84.5%
unsub-neg84.5%
associate--r+84.5%
+-commutative84.5%
associate--r+84.5%
Simplified84.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 96.6%
mul-1-neg96.6%
unpow296.6%
distribute-rgt-neg-in96.6%
Simplified96.6%
if -2 < M < 2.35e21Initial program 71.6%
*-commutative71.6%
associate-*r/71.6%
associate--r-71.6%
+-commutative71.6%
associate-+r-71.6%
unsub-neg71.6%
associate--r+71.6%
+-commutative71.6%
associate--r+71.6%
Simplified71.6%
Taylor expanded in K around 0 95.0%
cos-neg95.0%
Simplified95.0%
Taylor expanded in n around 0 89.2%
associate-+r+89.2%
unpow289.2%
distribute-rgt-out91.4%
*-commutative91.4%
unpow291.4%
Simplified91.4%
Taylor expanded in M around 0 91.4%
Taylor expanded in M around 0 91.4%
if 2.35e21 < M Initial program 70.0%
*-commutative70.0%
associate-*r/70.0%
associate--r-70.0%
+-commutative70.0%
associate-+r-70.0%
unsub-neg70.0%
associate--r+70.0%
+-commutative70.0%
associate--r+70.0%
Simplified70.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 80.0%
associate-+r+80.0%
unpow280.0%
distribute-rgt-out86.7%
*-commutative86.7%
unpow286.7%
Simplified86.7%
Taylor expanded in M around 0 85.0%
Taylor expanded in M around inf 98.4%
neg-mul-198.4%
unpow298.4%
distribute-rgt-neg-in98.4%
Simplified98.4%
Final simplification94.2%
NOTE: m and n should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= m -80000000000.0)
(exp (* -0.25 (* m m)))
(if (<= m 3e-303)
(* (cos (- (* (+ m n) (/ K 2.0)) M)) (exp (- (- m (+ n l)) (* M M))))
(exp (- (- (fabs (- m n)) l) (* (* n n) 0.25))))))assert(m < n);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -80000000000.0) {
tmp = exp((-0.25 * (m * m)));
} else if (m <= 3e-303) {
tmp = cos((((m + n) * (K / 2.0)) - M)) * exp(((m - (n + l)) - (M * M)));
} else {
tmp = exp(((fabs((m - n)) - l) - ((n * n) * 0.25)));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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 <= (-80000000000.0d0)) then
tmp = exp(((-0.25d0) * (m * m)))
else if (m <= 3d-303) then
tmp = cos((((m + n) * (k / 2.0d0)) - m_1)) * exp(((m - (n + l)) - (m_1 * m_1)))
else
tmp = exp(((abs((m - n)) - l) - ((n * n) * 0.25d0)))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -80000000000.0) {
tmp = Math.exp((-0.25 * (m * m)));
} else if (m <= 3e-303) {
tmp = Math.cos((((m + n) * (K / 2.0)) - M)) * Math.exp(((m - (n + l)) - (M * M)));
} else {
tmp = Math.exp(((Math.abs((m - n)) - l) - ((n * n) * 0.25)));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): tmp = 0 if m <= -80000000000.0: tmp = math.exp((-0.25 * (m * m))) elif m <= 3e-303: tmp = math.cos((((m + n) * (K / 2.0)) - M)) * math.exp(((m - (n + l)) - (M * M))) else: tmp = math.exp(((math.fabs((m - n)) - l) - ((n * n) * 0.25))) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -80000000000.0) tmp = exp(Float64(-0.25 * Float64(m * m))); elseif (m <= 3e-303) tmp = Float64(cos(Float64(Float64(Float64(m + n) * Float64(K / 2.0)) - M)) * exp(Float64(Float64(m - Float64(n + l)) - Float64(M * M)))); else tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(Float64(n * n) * 0.25))); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -80000000000.0)
tmp = exp((-0.25 * (m * m)));
elseif (m <= 3e-303)
tmp = cos((((m + n) * (K / 2.0)) - M)) * exp(((m - (n + l)) - (M * M)));
else
tmp = exp(((abs((m - n)) - l) - ((n * n) * 0.25)));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -80000000000.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, 3e-303], N[(N[Cos[N[(N[(N[(m + n), $MachinePrecision] * N[(K / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -80000000000:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;m \leq 3 \cdot 10^{-303}:\\
\;\;\;\;\cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{\left(m - \left(n + \ell\right)\right) - M \cdot M}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) - \left(n \cdot n\right) \cdot 0.25}\\
\end{array}
\end{array}
if m < -8e10Initial program 62.3%
*-commutative62.3%
associate-*r/62.3%
associate--r-62.3%
+-commutative62.3%
associate-+r-62.3%
unsub-neg62.3%
associate--r+62.3%
+-commutative62.3%
associate--r+62.3%
Simplified62.3%
Taylor expanded in K around 0 95.1%
cos-neg95.1%
Simplified95.1%
Taylor expanded in n around 0 73.8%
associate-+r+73.8%
unpow273.8%
distribute-rgt-out83.6%
*-commutative83.6%
unpow283.6%
Simplified83.6%
Taylor expanded in M around 0 83.6%
Taylor expanded in m around inf 91.9%
*-commutative91.9%
unpow291.9%
Simplified91.9%
if -8e10 < m < 3.00000000000000028e-303Initial program 81.8%
*-commutative81.8%
associate-*r/81.8%
associate--r-81.8%
+-commutative81.8%
associate-+r-81.8%
unsub-neg81.8%
associate--r+81.8%
+-commutative81.8%
associate--r+81.8%
Simplified81.8%
exp-diff37.3%
add-sqr-sqrt7.9%
fabs-sqr7.9%
add-sqr-sqrt55.1%
add-sqr-sqrt55.1%
add-sqr-sqrt55.1%
div-inv55.1%
fma-neg55.1%
metadata-eval55.1%
Applied egg-rr55.1%
div-exp80.5%
associate--l-80.5%
fma-neg80.5%
*-commutative80.5%
+-commutative80.5%
Simplified80.5%
Taylor expanded in M around inf 69.6%
unpow269.6%
Simplified69.6%
if 3.00000000000000028e-303 < m Initial program 76.0%
*-commutative76.0%
associate-*r/76.0%
associate--r-76.0%
+-commutative76.0%
associate-+r-76.0%
unsub-neg76.0%
associate--r+76.0%
+-commutative76.0%
associate--r+76.0%
Simplified76.0%
Taylor expanded in n around inf 50.9%
*-commutative50.9%
unpow250.9%
Simplified50.9%
Taylor expanded in n around inf 50.2%
Taylor expanded in n around 0 69.0%
Final simplification74.6%
NOTE: m and n should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (- (fabs (- m n)) l) (* M M))))
(t_1 (exp (* -0.25 (* m m)))))
(if (<= n -2.9e-236)
(* (cos M) t_1)
(if (<= n 1.75e-271)
t_0
(if (<= n 4.8e-254)
t_1
(if (<= n 14.2) t_0 (exp (* (* n n) -0.25))))))))assert(m < n);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((fabs((m - n)) - l) - (M * M)));
double t_1 = exp((-0.25 * (m * m)));
double tmp;
if (n <= -2.9e-236) {
tmp = cos(M) * t_1;
} else if (n <= 1.75e-271) {
tmp = t_0;
} else if (n <= 4.8e-254) {
tmp = t_1;
} else if (n <= 14.2) {
tmp = t_0;
} else {
tmp = exp(((n * n) * -0.25));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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) :: t_1
real(8) :: tmp
t_0 = exp(((abs((m - n)) - l) - (m_1 * m_1)))
t_1 = exp(((-0.25d0) * (m * m)))
if (n <= (-2.9d-236)) then
tmp = cos(m_1) * t_1
else if (n <= 1.75d-271) then
tmp = t_0
else if (n <= 4.8d-254) then
tmp = t_1
else if (n <= 14.2d0) then
tmp = t_0
else
tmp = exp(((n * n) * (-0.25d0)))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((Math.abs((m - n)) - l) - (M * M)));
double t_1 = Math.exp((-0.25 * (m * m)));
double tmp;
if (n <= -2.9e-236) {
tmp = Math.cos(M) * t_1;
} else if (n <= 1.75e-271) {
tmp = t_0;
} else if (n <= 4.8e-254) {
tmp = t_1;
} else if (n <= 14.2) {
tmp = t_0;
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): t_0 = math.exp(((math.fabs((m - n)) - l) - (M * M))) t_1 = math.exp((-0.25 * (m * m))) tmp = 0 if n <= -2.9e-236: tmp = math.cos(M) * t_1 elif n <= 1.75e-271: tmp = t_0 elif n <= 4.8e-254: tmp = t_1 elif n <= 14.2: tmp = t_0 else: tmp = math.exp(((n * n) * -0.25)) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) t_0 = exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(M * M))) t_1 = exp(Float64(-0.25 * Float64(m * m))) tmp = 0.0 if (n <= -2.9e-236) tmp = Float64(cos(M) * t_1); elseif (n <= 1.75e-271) tmp = t_0; elseif (n <= 4.8e-254) tmp = t_1; elseif (n <= 14.2) tmp = t_0; else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = exp(((abs((m - n)) - l) - (M * M)));
t_1 = exp((-0.25 * (m * m)));
tmp = 0.0;
if (n <= -2.9e-236)
tmp = cos(M) * t_1;
elseif (n <= 1.75e-271)
tmp = t_0;
elseif (n <= 4.8e-254)
tmp = t_1;
elseif (n <= 14.2)
tmp = t_0;
else
tmp = exp(((n * n) * -0.25));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -2.9e-236], N[(N[Cos[M], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[n, 1.75e-271], t$95$0, If[LessEqual[n, 4.8e-254], t$95$1, If[LessEqual[n, 14.2], t$95$0, N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]]]]]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
t_0 := e^{\left(\left|m - n\right| - \ell\right) - M \cdot M}\\
t_1 := e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{if}\;n \leq -2.9 \cdot 10^{-236}:\\
\;\;\;\;\cos M \cdot t_1\\
\mathbf{elif}\;n \leq 1.75 \cdot 10^{-271}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 4.8 \cdot 10^{-254}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq 14.2:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if n < -2.9e-236Initial program 72.6%
*-commutative72.6%
associate-*r/72.6%
associate--r-72.6%
+-commutative72.6%
associate-+r-72.6%
unsub-neg72.6%
associate--r+72.6%
+-commutative72.6%
associate--r+72.6%
Simplified72.6%
Taylor expanded in K around 0 99.1%
cos-neg99.1%
Simplified99.1%
Taylor expanded in m around inf 50.6%
unpow250.6%
Simplified50.6%
if -2.9e-236 < n < 1.75e-271 or 4.80000000000000003e-254 < n < 14.199999999999999Initial program 88.3%
*-commutative88.3%
associate-*r/88.3%
associate--r-88.3%
+-commutative88.3%
associate-+r-88.3%
unsub-neg88.3%
associate--r+88.3%
+-commutative88.3%
associate--r+88.3%
Simplified88.3%
Taylor expanded in K around 0 93.2%
cos-neg93.2%
Simplified93.2%
Taylor expanded in M around inf 72.9%
unpow272.9%
Simplified72.9%
Taylor expanded in M around 0 71.5%
if 1.75e-271 < n < 4.80000000000000003e-254Initial program 66.7%
*-commutative66.7%
associate-*r/66.7%
associate--r-66.7%
+-commutative66.7%
associate-+r-66.7%
unsub-neg66.7%
associate--r+66.7%
+-commutative66.7%
associate--r+66.7%
Simplified66.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 100.0%
associate-+r+100.0%
unpow2100.0%
distribute-rgt-out100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Taylor expanded in m around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
if 14.199999999999999 < n Initial program 63.2%
*-commutative63.2%
associate-*r/63.2%
associate--r-63.2%
+-commutative63.2%
associate-+r-63.2%
unsub-neg63.2%
associate--r+63.2%
+-commutative63.2%
associate--r+63.2%
Simplified63.2%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in n around 0 75.2%
associate-+r+75.2%
unpow275.2%
distribute-rgt-out82.1%
*-commutative82.1%
unpow282.1%
Simplified82.1%
Taylor expanded in M around 0 82.1%
Taylor expanded in n around inf 94.7%
*-commutative94.7%
unpow294.7%
Simplified94.7%
Final simplification70.1%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (<= m -56.0) (exp (* -0.25 (* m m))) (exp (- (- (fabs (- m n)) l) (* (* n n) 0.25)))))
assert(m < n);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -56.0) {
tmp = exp((-0.25 * (m * m)));
} else {
tmp = exp(((fabs((m - n)) - l) - ((n * n) * 0.25)));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-56.0d0)) then
tmp = exp(((-0.25d0) * (m * m)))
else
tmp = exp(((abs((m - n)) - l) - ((n * n) * 0.25d0)))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -56.0) {
tmp = Math.exp((-0.25 * (m * m)));
} else {
tmp = Math.exp(((Math.abs((m - n)) - l) - ((n * n) * 0.25)));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): tmp = 0 if m <= -56.0: tmp = math.exp((-0.25 * (m * m))) else: tmp = math.exp(((math.fabs((m - n)) - l) - ((n * n) * 0.25))) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -56.0) tmp = exp(Float64(-0.25 * Float64(m * m))); else tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(Float64(n * n) * 0.25))); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -56.0)
tmp = exp((-0.25 * (m * m)));
else
tmp = exp(((abs((m - n)) - l) - ((n * n) * 0.25)));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -56.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -56:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) - \left(n \cdot n\right) \cdot 0.25}\\
\end{array}
\end{array}
if m < -56Initial program 62.3%
*-commutative62.3%
associate-*r/62.3%
associate--r-62.3%
+-commutative62.3%
associate-+r-62.3%
unsub-neg62.3%
associate--r+62.3%
+-commutative62.3%
associate--r+62.3%
Simplified62.3%
Taylor expanded in K around 0 95.1%
cos-neg95.1%
Simplified95.1%
Taylor expanded in n around 0 74.8%
associate-+r+74.8%
unpow274.8%
distribute-rgt-out84.2%
*-commutative84.2%
unpow284.2%
Simplified84.2%
Taylor expanded in M around 0 84.2%
Taylor expanded in m around inf 90.8%
*-commutative90.8%
unpow290.8%
Simplified90.8%
if -56 < m Initial program 78.1%
*-commutative78.1%
associate-*r/78.1%
associate--r-78.1%
+-commutative78.1%
associate-+r-78.1%
unsub-neg78.1%
associate--r+78.1%
+-commutative78.1%
associate--r+78.1%
Simplified78.1%
Taylor expanded in n around inf 55.3%
*-commutative55.3%
unpow255.3%
Simplified55.3%
Taylor expanded in n around inf 54.1%
Taylor expanded in n around 0 71.1%
Final simplification76.1%
NOTE: m and n should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= m -53.0)
(exp (* -0.25 (* m m)))
(if (<= m -2.85e-130)
(* (cos M) (exp (- l)))
(* (cos M) (exp (* n (* n -0.25)))))))assert(m < n);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = exp((-0.25 * (m * m)));
} else if (m <= -2.85e-130) {
tmp = cos(M) * exp(-l);
} else {
tmp = cos(M) * exp((n * (n * -0.25)));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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 <= (-53.0d0)) then
tmp = exp(((-0.25d0) * (m * m)))
else if (m <= (-2.85d-130)) then
tmp = cos(m_1) * exp(-l)
else
tmp = cos(m_1) * exp((n * (n * (-0.25d0))))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = Math.exp((-0.25 * (m * m)));
} else if (m <= -2.85e-130) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.cos(M) * Math.exp((n * (n * -0.25)));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): tmp = 0 if m <= -53.0: tmp = math.exp((-0.25 * (m * m))) elif m <= -2.85e-130: tmp = math.cos(M) * math.exp(-l) else: tmp = math.cos(M) * math.exp((n * (n * -0.25))) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -53.0) tmp = exp(Float64(-0.25 * Float64(m * m))); elseif (m <= -2.85e-130) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = Float64(cos(M) * exp(Float64(n * Float64(n * -0.25)))); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -53.0)
tmp = exp((-0.25 * (m * m)));
elseif (m <= -2.85e-130)
tmp = cos(M) * exp(-l);
else
tmp = cos(M) * exp((n * (n * -0.25)));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -53.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -2.85e-130], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(n * -0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -53:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;m \leq -2.85 \cdot 10^{-130}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(n \cdot -0.25\right)}\\
\end{array}
\end{array}
if m < -53Initial program 62.3%
*-commutative62.3%
associate-*r/62.3%
associate--r-62.3%
+-commutative62.3%
associate-+r-62.3%
unsub-neg62.3%
associate--r+62.3%
+-commutative62.3%
associate--r+62.3%
Simplified62.3%
Taylor expanded in K around 0 95.1%
cos-neg95.1%
Simplified95.1%
Taylor expanded in n around 0 74.8%
associate-+r+74.8%
unpow274.8%
distribute-rgt-out84.2%
*-commutative84.2%
unpow284.2%
Simplified84.2%
Taylor expanded in M around 0 84.2%
Taylor expanded in m around inf 90.8%
*-commutative90.8%
unpow290.8%
Simplified90.8%
if -53 < m < -2.8499999999999999e-130Initial program 76.8%
*-commutative76.8%
associate-*r/76.8%
associate--r-76.8%
+-commutative76.8%
associate-+r-76.8%
unsub-neg76.8%
associate--r+76.8%
+-commutative76.8%
associate--r+76.8%
Simplified76.8%
Taylor expanded in K around 0 92.2%
cos-neg92.2%
Simplified92.2%
Taylor expanded in l around inf 54.1%
mul-1-neg54.1%
Simplified54.1%
if -2.8499999999999999e-130 < m Initial program 78.3%
*-commutative78.3%
associate-*r/78.3%
associate--r-78.3%
+-commutative78.3%
associate-+r-78.3%
unsub-neg78.3%
associate--r+78.3%
+-commutative78.3%
associate--r+78.3%
Simplified78.3%
Taylor expanded in K around 0 98.8%
cos-neg98.8%
Simplified98.8%
Taylor expanded in n around inf 58.8%
metadata-eval58.8%
distribute-lft-neg-in58.8%
*-commutative58.8%
unpow258.8%
associate-*r*58.8%
distribute-rgt-neg-in58.8%
distribute-rgt-neg-in58.8%
metadata-eval58.8%
Simplified58.8%
Final simplification66.4%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (<= m -53.0) (exp (* -0.25 (* m m))) (if (<= m -1.82e-127) (* (cos M) (exp (- l))) (exp (* (* n n) -0.25)))))
assert(m < n);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = exp((-0.25 * (m * m)));
} else if (m <= -1.82e-127) {
tmp = cos(M) * exp(-l);
} else {
tmp = exp(((n * n) * -0.25));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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 <= (-53.0d0)) then
tmp = exp(((-0.25d0) * (m * m)))
else if (m <= (-1.82d-127)) then
tmp = cos(m_1) * exp(-l)
else
tmp = exp(((n * n) * (-0.25d0)))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = Math.exp((-0.25 * (m * m)));
} else if (m <= -1.82e-127) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): tmp = 0 if m <= -53.0: tmp = math.exp((-0.25 * (m * m))) elif m <= -1.82e-127: tmp = math.cos(M) * math.exp(-l) else: tmp = math.exp(((n * n) * -0.25)) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -53.0) tmp = exp(Float64(-0.25 * Float64(m * m))); elseif (m <= -1.82e-127) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -53.0)
tmp = exp((-0.25 * (m * m)));
elseif (m <= -1.82e-127)
tmp = cos(M) * exp(-l);
else
tmp = exp(((n * n) * -0.25));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -53.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.82e-127], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -53:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;m \leq -1.82 \cdot 10^{-127}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if m < -53Initial program 62.3%
*-commutative62.3%
associate-*r/62.3%
associate--r-62.3%
+-commutative62.3%
associate-+r-62.3%
unsub-neg62.3%
associate--r+62.3%
+-commutative62.3%
associate--r+62.3%
Simplified62.3%
Taylor expanded in K around 0 95.1%
cos-neg95.1%
Simplified95.1%
Taylor expanded in n around 0 74.8%
associate-+r+74.8%
unpow274.8%
distribute-rgt-out84.2%
*-commutative84.2%
unpow284.2%
Simplified84.2%
Taylor expanded in M around 0 84.2%
Taylor expanded in m around inf 90.8%
*-commutative90.8%
unpow290.8%
Simplified90.8%
if -53 < m < -1.82000000000000002e-127Initial program 76.8%
*-commutative76.8%
associate-*r/76.8%
associate--r-76.8%
+-commutative76.8%
associate-+r-76.8%
unsub-neg76.8%
associate--r+76.8%
+-commutative76.8%
associate--r+76.8%
Simplified76.8%
Taylor expanded in K around 0 92.2%
cos-neg92.2%
Simplified92.2%
Taylor expanded in l around inf 54.1%
mul-1-neg54.1%
Simplified54.1%
if -1.82000000000000002e-127 < m Initial program 78.3%
*-commutative78.3%
associate-*r/78.3%
associate--r-78.3%
+-commutative78.3%
associate-+r-78.3%
unsub-neg78.3%
associate--r+78.3%
+-commutative78.3%
associate--r+78.3%
Simplified78.3%
Taylor expanded in K around 0 98.8%
cos-neg98.8%
Simplified98.8%
Taylor expanded in n around 0 90.5%
associate-+r+90.5%
unpow290.5%
distribute-rgt-out95.3%
*-commutative95.3%
unpow295.3%
Simplified95.3%
Taylor expanded in M around 0 94.1%
Taylor expanded in n around inf 58.8%
*-commutative58.8%
unpow258.8%
Simplified58.8%
Final simplification66.4%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (or (<= m -53.0) (not (<= m 4.3e-39))) (exp (* -0.25 (* m m))) (exp (* M (- M)))))
assert(m < n);
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -53.0) || !(m <= 4.3e-39)) {
tmp = exp((-0.25 * (m * m)));
} else {
tmp = exp((M * -M));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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 <= (-53.0d0)) .or. (.not. (m <= 4.3d-39))) then
tmp = exp(((-0.25d0) * (m * m)))
else
tmp = exp((m_1 * -m_1))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -53.0) || !(m <= 4.3e-39)) {
tmp = Math.exp((-0.25 * (m * m)));
} else {
tmp = Math.exp((M * -M));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): tmp = 0 if (m <= -53.0) or not (m <= 4.3e-39): tmp = math.exp((-0.25 * (m * m))) else: tmp = math.exp((M * -M)) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) tmp = 0.0 if ((m <= -53.0) || !(m <= 4.3e-39)) tmp = exp(Float64(-0.25 * Float64(m * m))); else tmp = exp(Float64(M * Float64(-M))); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if ((m <= -53.0) || ~((m <= 4.3e-39)))
tmp = exp((-0.25 * (m * m)));
else
tmp = exp((M * -M));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -53.0], N[Not[LessEqual[m, 4.3e-39]], $MachinePrecision]], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -53 \lor \neg \left(m \leq 4.3 \cdot 10^{-39}\right):\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{M \cdot \left(-M\right)}\\
\end{array}
\end{array}
if m < -53 or 4.2999999999999999e-39 < m Initial program 69.3%
*-commutative69.3%
associate-*r/69.3%
associate--r-69.3%
+-commutative69.3%
associate-+r-69.3%
unsub-neg69.3%
associate--r+69.3%
+-commutative69.3%
associate--r+69.3%
Simplified69.3%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in n around 0 82.7%
associate-+r+82.7%
unpow282.7%
distribute-rgt-out90.2%
*-commutative90.2%
unpow290.2%
Simplified90.2%
Taylor expanded in M around 0 89.5%
Taylor expanded in m around inf 89.3%
*-commutative89.3%
unpow289.3%
Simplified89.3%
if -53 < m < 4.2999999999999999e-39Initial program 79.4%
*-commutative79.4%
associate-*r/79.4%
associate--r-79.4%
+-commutative79.4%
associate-+r-79.4%
unsub-neg79.4%
associate--r+79.4%
+-commutative79.4%
associate--r+79.4%
Simplified79.4%
Taylor expanded in K around 0 96.9%
cos-neg96.9%
Simplified96.9%
Taylor expanded in n around 0 88.7%
associate-+r+88.7%
unpow288.7%
distribute-rgt-out92.8%
*-commutative92.8%
unpow292.8%
Simplified92.8%
Taylor expanded in M around 0 91.2%
Taylor expanded in M around inf 55.6%
neg-mul-155.6%
unpow255.6%
distribute-rgt-neg-in55.6%
Simplified55.6%
Final simplification73.2%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (<= m -53.0) (exp (* -0.25 (* m m))) (if (<= m -1.72e-128) (exp (- l)) (exp (* (* n n) -0.25)))))
assert(m < n);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = exp((-0.25 * (m * m)));
} else if (m <= -1.72e-128) {
tmp = exp(-l);
} else {
tmp = exp(((n * n) * -0.25));
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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 <= (-53.0d0)) then
tmp = exp(((-0.25d0) * (m * m)))
else if (m <= (-1.72d-128)) then
tmp = exp(-l)
else
tmp = exp(((n * n) * (-0.25d0)))
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -53.0) {
tmp = Math.exp((-0.25 * (m * m)));
} else if (m <= -1.72e-128) {
tmp = Math.exp(-l);
} else {
tmp = Math.exp(((n * n) * -0.25));
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): tmp = 0 if m <= -53.0: tmp = math.exp((-0.25 * (m * m))) elif m <= -1.72e-128: tmp = math.exp(-l) else: tmp = math.exp(((n * n) * -0.25)) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -53.0) tmp = exp(Float64(-0.25 * Float64(m * m))); elseif (m <= -1.72e-128) tmp = exp(Float64(-l)); else tmp = exp(Float64(Float64(n * n) * -0.25)); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -53.0)
tmp = exp((-0.25 * (m * m)));
elseif (m <= -1.72e-128)
tmp = exp(-l);
else
tmp = exp(((n * n) * -0.25));
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -53.0], N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.72e-128], N[Exp[(-l)], $MachinePrecision], N[Exp[N[(N[(n * n), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -53:\\
\;\;\;\;e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;m \leq -1.72 \cdot 10^{-128}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n \cdot n\right) \cdot -0.25}\\
\end{array}
\end{array}
if m < -53Initial program 62.3%
*-commutative62.3%
associate-*r/62.3%
associate--r-62.3%
+-commutative62.3%
associate-+r-62.3%
unsub-neg62.3%
associate--r+62.3%
+-commutative62.3%
associate--r+62.3%
Simplified62.3%
Taylor expanded in K around 0 95.1%
cos-neg95.1%
Simplified95.1%
Taylor expanded in n around 0 74.8%
associate-+r+74.8%
unpow274.8%
distribute-rgt-out84.2%
*-commutative84.2%
unpow284.2%
Simplified84.2%
Taylor expanded in M around 0 84.2%
Taylor expanded in m around inf 90.8%
*-commutative90.8%
unpow290.8%
Simplified90.8%
if -53 < m < -1.71999999999999992e-128Initial program 76.8%
*-commutative76.8%
associate-*r/76.8%
associate--r-76.8%
+-commutative76.8%
associate-+r-76.8%
unsub-neg76.8%
associate--r+76.8%
+-commutative76.8%
associate--r+76.8%
Simplified76.8%
Taylor expanded in K around 0 92.2%
cos-neg92.2%
Simplified92.2%
Taylor expanded in l around inf 54.1%
mul-1-neg54.1%
Simplified54.1%
Taylor expanded in M around 0 49.8%
if -1.71999999999999992e-128 < m Initial program 78.3%
*-commutative78.3%
associate-*r/78.3%
associate--r-78.3%
+-commutative78.3%
associate-+r-78.3%
unsub-neg78.3%
associate--r+78.3%
+-commutative78.3%
associate--r+78.3%
Simplified78.3%
Taylor expanded in K around 0 98.8%
cos-neg98.8%
Simplified98.8%
Taylor expanded in n around 0 90.5%
associate-+r+90.5%
unpow290.5%
distribute-rgt-out95.3%
*-commutative95.3%
unpow295.3%
Simplified95.3%
Taylor expanded in M around 0 94.1%
Taylor expanded in n around inf 58.8%
*-commutative58.8%
unpow258.8%
Simplified58.8%
Final simplification66.0%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (or (<= M -2.0) (not (<= M 26.0))) (exp (* M (- M))) (exp (- l))))
assert(m < n);
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -2.0) || !(M <= 26.0)) {
tmp = exp((M * -M));
} else {
tmp = exp(-l);
}
return tmp;
}
NOTE: m and n should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m_1 <= (-2.0d0)) .or. (.not. (m_1 <= 26.0d0))) then
tmp = exp((m_1 * -m_1))
else
tmp = exp(-l)
end if
code = tmp
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -2.0) || !(M <= 26.0)) {
tmp = Math.exp((M * -M));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): tmp = 0 if (M <= -2.0) or not (M <= 26.0): tmp = math.exp((M * -M)) else: tmp = math.exp(-l) return tmp
m, n = sort([m, n]) function code(K, m, n, M, l) tmp = 0.0 if ((M <= -2.0) || !(M <= 26.0)) tmp = exp(Float64(M * Float64(-M))); else tmp = exp(Float64(-l)); end return tmp end
m, n = num2cell(sort([m, n])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if ((M <= -2.0) || ~((M <= 26.0)))
tmp = exp((M * -M));
else
tmp = exp(-l);
end
tmp_2 = tmp;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -2.0], N[Not[LessEqual[M, 26.0]], $MachinePrecision]], N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq -2 \lor \neg \left(M \leq 26\right):\\
\;\;\;\;e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if M < -2 or 26 < M Initial program 77.9%
*-commutative77.9%
associate-*r/77.9%
associate--r-77.9%
+-commutative77.9%
associate-+r-77.9%
unsub-neg77.9%
associate--r+77.9%
+-commutative77.9%
associate--r+77.9%
Simplified77.9%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 81.1%
associate-+r+81.1%
unpow281.1%
distribute-rgt-out91.0%
*-commutative91.0%
unpow291.0%
Simplified91.0%
Taylor expanded in M around 0 88.5%
Taylor expanded in M around inf 96.8%
neg-mul-196.8%
unpow296.8%
distribute-rgt-neg-in96.8%
Simplified96.8%
if -2 < M < 26Initial program 70.7%
*-commutative70.7%
associate-*r/70.7%
associate--r-70.7%
+-commutative70.7%
associate-+r-70.7%
unsub-neg70.7%
associate--r+70.7%
+-commutative70.7%
associate--r+70.7%
Simplified70.7%
Taylor expanded in K around 0 94.8%
cos-neg94.8%
Simplified94.8%
Taylor expanded in l around inf 44.3%
mul-1-neg44.3%
Simplified44.3%
Taylor expanded in M around 0 44.3%
Final simplification69.3%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (exp (- l)))
assert(m < n);
double code(double K, double m, double n, double M, double l) {
return exp(-l);
}
NOTE: m and n should be sorted in increasing order before calling this function.
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(-l)
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): return math.exp(-l)
m, n = sort([m, n]) function code(K, m, n, M, l) return exp(Float64(-l)) end
m, n = num2cell(sort([m, n])){:}
function tmp = code(K, m, n, M, l)
tmp = exp(-l);
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
e^{-\ell}
\end{array}
Initial program 74.1%
*-commutative74.1%
associate-*r/74.1%
associate--r-74.1%
+-commutative74.1%
associate-+r-74.1%
unsub-neg74.1%
associate--r+74.1%
+-commutative74.1%
associate--r+74.1%
Simplified74.1%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in l around inf 40.1%
mul-1-neg40.1%
Simplified40.1%
Taylor expanded in M around 0 38.9%
Final simplification38.9%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (cos M))
assert(m < n);
double code(double K, double m, double n, double M, double l) {
return cos(M);
}
NOTE: m and n should be sorted in increasing order before calling this function.
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1)
end function
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): return math.cos(M)
m, n = sort([m, n]) function code(K, m, n, M, l) return cos(M) end
m, n = num2cell(sort([m, n])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M);
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
\cos M
\end{array}
Initial program 74.1%
*-commutative74.1%
associate-*r/74.1%
associate--r-74.1%
+-commutative74.1%
associate-+r-74.1%
unsub-neg74.1%
associate--r+74.1%
+-commutative74.1%
associate--r+74.1%
Simplified74.1%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in l around inf 40.1%
mul-1-neg40.1%
Simplified40.1%
Taylor expanded in l around 0 6.6%
Final simplification6.6%
NOTE: m and n should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 1.0)
assert(m < n);
double code(double K, double m, double n, double M, double l) {
return 1.0;
}
NOTE: m and n should be sorted in increasing order before calling this function.
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
assert m < n;
public static double code(double K, double m, double n, double M, double l) {
return 1.0;
}
[m, n] = sort([m, n]) def code(K, m, n, M, l): return 1.0
m, n = sort([m, n]) function code(K, m, n, M, l) return 1.0 end
m, n = num2cell(sort([m, n])){:}
function tmp = code(K, m, n, M, l)
tmp = 1.0;
end
NOTE: m and n should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := 1.0
\begin{array}{l}
[m, n] = \mathsf{sort}([m, n])\\
\\
1
\end{array}
Initial program 74.1%
*-commutative74.1%
associate-*r/74.1%
associate--r-74.1%
+-commutative74.1%
associate-+r-74.1%
unsub-neg74.1%
associate--r+74.1%
+-commutative74.1%
associate--r+74.1%
Simplified74.1%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in l around inf 40.1%
mul-1-neg40.1%
Simplified40.1%
Taylor expanded in l around 0 6.6%
Taylor expanded in M around 0 6.6%
Final simplification6.6%
herbie shell --seed 2023229
(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)))))))