
(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 10 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: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* 0.5 (+ n m))))
(log
(pow
(exp (exp (+ (- n m) (- (* (- t_0 M) (- M t_0)) l))))
(cos (- (* 0.5 (* m K)) M))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
return log(pow(exp(exp(((n - m) + (((t_0 - M) * (M - t_0)) - l)))), cos(((0.5 * (m * K)) - M))));
}
NOTE: K, m, n, M, and l 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
t_0 = 0.5d0 * (n + m)
code = log((exp(exp(((n - m) + (((t_0 - m_1) * (m_1 - t_0)) - l)))) ** cos(((0.5d0 * (m * k)) - m_1))))
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
return Math.log(Math.pow(Math.exp(Math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l)))), Math.cos(((0.5 * (m * K)) - M))));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = 0.5 * (n + m) return math.log(math.pow(math.exp(math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l)))), math.cos(((0.5 * (m * K)) - M))))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = Float64(0.5 * Float64(n + m)) return log((exp(exp(Float64(Float64(n - m) + Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) - l)))) ^ cos(Float64(Float64(0.5 * Float64(m * K)) - M)))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
t_0 = 0.5 * (n + m);
tmp = log((exp(exp(((n - m) + (((t_0 - M) * (M - t_0)) - l)))) ^ cos(((0.5 * (m * K)) - M))));
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, N[Log[N[Power[N[Exp[N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]], $MachinePrecision], N[Cos[N[(N[(0.5 * N[(m * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right)\\
\log \left({\left(e^{e^{\left(n - m\right) + \left(\left(t\_0 - M\right) \cdot \left(M - t\_0\right) - \ell\right)}}\right)}^{\cos \left(0.5 \cdot \left(m \cdot K\right) - M\right)}\right)
\end{array}
\end{array}
Initial program 76.3%
Simplified76.3%
add-log-exp76.3%
*-commutative76.3%
exp-prod96.2%
Applied egg-rr96.2%
unpow296.2%
+-commutative96.2%
+-commutative96.2%
Applied egg-rr96.2%
Taylor expanded in n around 0 96.2%
*-commutative96.2%
Simplified96.2%
Final simplification96.2%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (fabs (- n m)) l) (pow (- (/ (+ n m) 2.0) M) 2.0)))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((n - m)) - l) - pow((((n + m) / 2.0) - M), 2.0)));
}
NOTE: K, m, n, M, and l 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((n - m)) - l) - ((((n + m) / 2.0d0) - m_1) ** 2.0d0)))
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((n - m)) - l) - Math.pow((((n + m) / 2.0) - M), 2.0)));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((n - m)) - l) - math.pow((((n + m) / 2.0) - M), 2.0)))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(n - m)) - l) - (Float64(Float64(Float64(n + m) / 2.0) - M) ^ 2.0)))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M) * exp(((abs((n - m)) - l) - ((((n + m) / 2.0) - M) ^ 2.0)));
end
NOTE: K, m, n, M, and l 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[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - {\left(\frac{n + m}{2} - M\right)}^{2}}
\end{array}
Initial program 76.3%
Simplified76.3%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Final simplification96.7%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= m -5e+42)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= m 2.8e-274)
(/
(cos (- (* 0.5 (* m K)) M))
(exp (+ (+ m l) (pow (- (* m 0.5) M) 2.0))))
(*
(cos (- (* m (* 0.5 K)) M))
(exp (- n (+ m (pow (- (* 0.5 (+ n m)) M) 2.0))))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -5e+42) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (m <= 2.8e-274) {
tmp = cos(((0.5 * (m * K)) - M)) / exp(((m + l) + pow(((m * 0.5) - M), 2.0)));
} else {
tmp = cos(((m * (0.5 * K)) - M)) * exp((n - (m + pow(((0.5 * (n + m)) - M), 2.0))));
}
return tmp;
}
NOTE: K, m, n, M, and l 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 <= (-5d+42)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= 2.8d-274) then
tmp = cos(((0.5d0 * (m * k)) - m_1)) / exp(((m + l) + (((m * 0.5d0) - m_1) ** 2.0d0)))
else
tmp = cos(((m * (0.5d0 * k)) - m_1)) * exp((n - (m + (((0.5d0 * (n + m)) - m_1) ** 2.0d0))))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -5e+42) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= 2.8e-274) {
tmp = Math.cos(((0.5 * (m * K)) - M)) / Math.exp(((m + l) + Math.pow(((m * 0.5) - M), 2.0)));
} else {
tmp = Math.cos(((m * (0.5 * K)) - M)) * Math.exp((n - (m + Math.pow(((0.5 * (n + m)) - M), 2.0))));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if m <= -5e+42: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif m <= 2.8e-274: tmp = math.cos(((0.5 * (m * K)) - M)) / math.exp(((m + l) + math.pow(((m * 0.5) - M), 2.0))) else: tmp = math.cos(((m * (0.5 * K)) - M)) * math.exp((n - (m + math.pow(((0.5 * (n + m)) - M), 2.0)))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -5e+42) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (m <= 2.8e-274) tmp = Float64(cos(Float64(Float64(0.5 * Float64(m * K)) - M)) / exp(Float64(Float64(m + l) + (Float64(Float64(m * 0.5) - M) ^ 2.0)))); else tmp = Float64(cos(Float64(Float64(m * Float64(0.5 * K)) - M)) * exp(Float64(n - Float64(m + (Float64(Float64(0.5 * Float64(n + m)) - M) ^ 2.0))))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -5e+42)
tmp = cos(M) * exp((-0.25 * (m ^ 2.0)));
elseif (m <= 2.8e-274)
tmp = cos(((0.5 * (m * K)) - M)) / exp(((m + l) + (((m * 0.5) - M) ^ 2.0)));
else
tmp = cos(((m * (0.5 * K)) - M)) * exp((n - (m + (((0.5 * (n + m)) - M) ^ 2.0))));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -5e+42], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.8e-274], N[(N[Cos[N[(N[(0.5 * N[(m * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] / N[Exp[N[(N[(m + l), $MachinePrecision] + N[Power[N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(N[(m * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(n - N[(m + N[Power[N[(N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5 \cdot 10^{+42}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq 2.8 \cdot 10^{-274}:\\
\;\;\;\;\frac{\cos \left(0.5 \cdot \left(m \cdot K\right) - M\right)}{e^{\left(m + \ell\right) + {\left(m \cdot 0.5 - M\right)}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(m \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{n - \left(m + {\left(0.5 \cdot \left(n + m\right) - M\right)}^{2}\right)}\\
\end{array}
\end{array}
if m < -5.00000000000000007e42Initial program 71.2%
Simplified71.2%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Taylor expanded in m around inf 98.1%
if -5.00000000000000007e42 < m < 2.79999999999999975e-274Initial program 83.6%
Simplified83.6%
expm1-log1p-u51.1%
expm1-undefine51.0%
div-inv51.0%
metadata-eval51.0%
Applied egg-rr51.0%
expm1-define51.1%
fma-neg51.1%
*-commutative51.1%
fma-define51.1%
*-commutative51.1%
fma-define51.1%
+-commutative51.1%
remove-double-neg51.1%
mul-1-neg51.1%
sub-neg51.1%
fma-neg51.1%
cancel-sign-sub-inv51.1%
metadata-eval51.1%
*-lft-identity51.1%
+-commutative51.1%
*-commutative51.1%
+-commutative51.1%
Simplified51.1%
associate--l-51.1%
div-inv51.1%
metadata-eval51.1%
+-commutative51.1%
exp-diff30.8%
add-sqr-sqrt20.4%
fabs-sqr20.4%
add-sqr-sqrt41.0%
exp-diff51.1%
associate--l-51.1%
exp-diff44.3%
Applied egg-rr44.3%
Taylor expanded in n around 0 81.8%
associate-+r+81.8%
+-commutative81.8%
Simplified81.8%
if 2.79999999999999975e-274 < m Initial program 73.1%
Simplified73.1%
*-commutative73.1%
associate--l-73.1%
add-sqr-sqrt23.5%
fabs-sqr23.5%
add-sqr-sqrt73.1%
+-commutative73.1%
div-inv73.1%
metadata-eval73.1%
Applied egg-rr73.1%
Taylor expanded in l around 0 65.5%
Taylor expanded in m around inf 74.2%
associate-*r*74.2%
Simplified74.2%
Final simplification81.7%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (* (cos M) (pow E (- (- (- n m) l) (pow (- (* 0.5 (+ n m)) M) 2.0)))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return cos(M) * pow(((double) M_E), (((n - m) - l) - pow(((0.5 * (n + m)) - M), 2.0)));
}
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.pow(Math.E, (((n - m) - l) - Math.pow(((0.5 * (n + m)) - M), 2.0)));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.cos(M) * math.pow(math.e, (((n - m) - l) - math.pow(((0.5 * (n + m)) - M), 2.0)))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(cos(M) * (exp(1) ^ Float64(Float64(Float64(n - m) - l) - (Float64(Float64(0.5 * Float64(n + m)) - M) ^ 2.0)))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M) * (2.71828182845904523536 ^ (((n - m) - l) - (((0.5 * (n + m)) - M) ^ 2.0)));
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Power[E, N[(N[(N[(n - m), $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\cos M \cdot {e}^{\left(\left(\left(n - m\right) - \ell\right) - {\left(0.5 \cdot \left(n + m\right) - M\right)}^{2}\right)}
\end{array}
Initial program 76.3%
Simplified76.3%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
*-un-lft-identity96.7%
exp-prod96.7%
add-sqr-sqrt52.3%
fabs-sqr52.3%
add-sqr-sqrt96.7%
div-inv96.7%
metadata-eval96.7%
+-commutative96.7%
Applied egg-rr96.7%
Final simplification96.7%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* 0.5 (+ n m))))
(if (or (<= m -5e+41) (not (<= m 54.0)))
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(exp (+ (- n m) (- (* (- t_0 M) (- M t_0)) l)))
(cos (- (* (+ n m) (* 0.5 K)) M))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
double tmp;
if ((m <= -5e+41) || !(m <= 54.0)) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos((((n + m) * (0.5 * K)) - M));
}
return tmp;
}
NOTE: K, m, n, M, and l 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 = 0.5d0 * (n + m)
if ((m <= (-5d+41)) .or. (.not. (m <= 54.0d0))) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = exp(((n - m) + (((t_0 - m_1) * (m_1 - t_0)) - l))) * cos((((n + m) * (0.5d0 * k)) - m_1))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
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 <= -5e+41) || !(m <= 54.0)) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * Math.cos((((n + m) * (0.5 * K)) - M));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = 0.5 * (n + m) tmp = 0 if (m <= -5e+41) or not (m <= 54.0): tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * math.cos((((n + m) * (0.5 * K)) - M)) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = Float64(0.5 * Float64(n + m)) tmp = 0.0 if ((m <= -5e+41) || !(m <= 54.0)) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(exp(Float64(Float64(n - m) + Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) - l))) * cos(Float64(Float64(Float64(n + m) * Float64(0.5 * K)) - M))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = 0.5 * (n + m);
tmp = 0.0;
if ((m <= -5e+41) || ~((m <= 54.0)))
tmp = cos(M) * exp((-0.25 * (m ^ 2.0)));
else
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos((((n + m) * (0.5 * K)) - M));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[m, -5e+41], N[Not[LessEqual[m, 54.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[(n + m), $MachinePrecision] * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right)\\
\mathbf{if}\;m \leq -5 \cdot 10^{+41} \lor \neg \left(m \leq 54\right):\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n - m\right) + \left(\left(t\_0 - M\right) \cdot \left(M - t\_0\right) - \ell\right)} \cdot \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right)\\
\end{array}
\end{array}
if m < -5.00000000000000022e41 or 54 < m Initial program 69.2%
Simplified69.2%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in m around inf 95.0%
if -5.00000000000000022e41 < m < 54Initial program 82.3%
Simplified82.3%
*-commutative82.3%
associate--l-82.3%
add-sqr-sqrt46.3%
fabs-sqr46.3%
add-sqr-sqrt82.3%
+-commutative82.3%
div-inv82.3%
metadata-eval82.3%
Applied egg-rr82.3%
unpow296.0%
+-commutative96.0%
+-commutative96.0%
Applied egg-rr82.3%
Final simplification88.1%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* 0.5 (+ n m))))
(if (<= n -8e-94)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 1200.0)
(*
(exp (+ (- n m) (- (* (- t_0 M) (- M t_0)) l)))
(cos (- (* (+ n m) (* 0.5 K)) M)))
(* (cos M) (exp (* -0.25 (pow n 2.0))))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
double tmp;
if (n <= -8e-94) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 1200.0) {
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos((((n + m) * (0.5 * K)) - M));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
NOTE: K, m, n, M, and l 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 = 0.5d0 * (n + m)
if (n <= (-8d-94)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (n <= 1200.0d0) then
tmp = exp(((n - m) + (((t_0 - m_1) * (m_1 - t_0)) - l))) * cos((((n + m) * (0.5d0 * k)) - m_1))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
double tmp;
if (n <= -8e-94) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 1200.0) {
tmp = Math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * Math.cos((((n + m) * (0.5 * K)) - M));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = 0.5 * (n + m) tmp = 0 if n <= -8e-94: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 1200.0: tmp = math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * math.cos((((n + m) * (0.5 * K)) - M)) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = Float64(0.5 * Float64(n + m)) tmp = 0.0 if (n <= -8e-94) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 1200.0) tmp = Float64(exp(Float64(Float64(n - m) + Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) - l))) * cos(Float64(Float64(Float64(n + m) * Float64(0.5 * K)) - M))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = 0.5 * (n + m);
tmp = 0.0;
if (n <= -8e-94)
tmp = cos(M) * exp((-0.25 * (m ^ 2.0)));
elseif (n <= 1200.0)
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos((((n + m) * (0.5 * K)) - M));
else
tmp = cos(M) * exp((-0.25 * (n ^ 2.0)));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -8e-94], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1200.0], N[(N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[(n + m), $MachinePrecision] * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right)\\
\mathbf{if}\;n \leq -8 \cdot 10^{-94}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 1200:\\
\;\;\;\;e^{\left(n - m\right) + \left(\left(t\_0 - M\right) \cdot \left(M - t\_0\right) - \ell\right)} \cdot \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < -7.9999999999999996e-94Initial program 76.6%
Simplified76.6%
Taylor expanded in K around 0 97.8%
cos-neg97.8%
Simplified97.8%
Taylor expanded in m around inf 52.4%
if -7.9999999999999996e-94 < n < 1200Initial program 83.3%
Simplified83.3%
*-commutative83.3%
associate--l-83.3%
add-sqr-sqrt51.8%
fabs-sqr51.8%
add-sqr-sqrt83.3%
+-commutative83.3%
div-inv83.3%
metadata-eval83.3%
Applied egg-rr83.3%
unpow292.7%
+-commutative92.7%
+-commutative92.7%
Applied egg-rr83.3%
if 1200 < n Initial program 65.7%
Simplified65.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 98.6%
Final simplification77.7%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* 0.5 (+ n m))))
(if (or (<= M -8.4e+18) (not (<= M 1.4e+41)))
(* (cos M) (exp (- (pow M 2.0))))
(*
(exp (+ (- n m) (- (* (- t_0 M) (- M t_0)) l)))
(cos (- (* (+ n m) (* 0.5 K)) M))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
double tmp;
if ((M <= -8.4e+18) || !(M <= 1.4e+41)) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos((((n + m) * (0.5 * K)) - M));
}
return tmp;
}
NOTE: K, m, n, M, and l 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 = 0.5d0 * (n + m)
if ((m_1 <= (-8.4d+18)) .or. (.not. (m_1 <= 1.4d+41))) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = exp(((n - m) + (((t_0 - m_1) * (m_1 - t_0)) - l))) * cos((((n + m) * (0.5d0 * k)) - m_1))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
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 <= -8.4e+18) || !(M <= 1.4e+41)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * Math.cos((((n + m) * (0.5 * K)) - M));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = 0.5 * (n + m) tmp = 0 if (M <= -8.4e+18) or not (M <= 1.4e+41): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * math.cos((((n + m) * (0.5 * K)) - M)) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = Float64(0.5 * Float64(n + m)) tmp = 0.0 if ((M <= -8.4e+18) || !(M <= 1.4e+41)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(exp(Float64(Float64(n - m) + Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) - l))) * cos(Float64(Float64(Float64(n + m) * Float64(0.5 * K)) - M))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = 0.5 * (n + m);
tmp = 0.0;
if ((M <= -8.4e+18) || ~((M <= 1.4e+41)))
tmp = cos(M) * exp(-(M ^ 2.0));
else
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos((((n + m) * (0.5 * K)) - M));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, If[Or[LessEqual[M, -8.4e+18], N[Not[LessEqual[M, 1.4e+41]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[(n + m), $MachinePrecision] * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right)\\
\mathbf{if}\;M \leq -8.4 \cdot 10^{+18} \lor \neg \left(M \leq 1.4 \cdot 10^{+41}\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n - m\right) + \left(\left(t\_0 - M\right) \cdot \left(M - t\_0\right) - \ell\right)} \cdot \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right)\\
\end{array}
\end{array}
if M < -8.4e18 or 1.4e41 < M Initial program 78.8%
Simplified78.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 99.3%
mul-1-neg99.3%
Simplified99.3%
if -8.4e18 < M < 1.4e41Initial program 73.7%
Simplified73.7%
*-commutative73.7%
associate--l-73.7%
add-sqr-sqrt35.8%
fabs-sqr35.8%
add-sqr-sqrt73.7%
+-commutative73.7%
div-inv73.7%
metadata-eval73.7%
Applied egg-rr73.7%
unpow292.2%
+-commutative92.2%
+-commutative92.2%
Applied egg-rr73.7%
Final simplification86.9%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* 0.5 (+ n m))))
(if (<= l 740.0)
(*
(exp (+ (- n m) (- (* (- t_0 M) (- M t_0)) l)))
(cos (- (* (+ n m) (* 0.5 K)) M)))
(exp (- l)))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
double tmp;
if (l <= 740.0) {
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos((((n + m) * (0.5 * K)) - M));
} else {
tmp = exp(-l);
}
return tmp;
}
NOTE: K, m, n, M, and l 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 = 0.5d0 * (n + m)
if (l <= 740.0d0) then
tmp = exp(((n - m) + (((t_0 - m_1) * (m_1 - t_0)) - l))) * cos((((n + m) * (0.5d0 * k)) - m_1))
else
tmp = exp(-l)
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = 0.5 * (n + m);
double tmp;
if (l <= 740.0) {
tmp = Math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * Math.cos((((n + m) * (0.5 * K)) - M));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = 0.5 * (n + m) tmp = 0 if l <= 740.0: tmp = math.exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * math.cos((((n + m) * (0.5 * K)) - M)) else: tmp = math.exp(-l) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = Float64(0.5 * Float64(n + m)) tmp = 0.0 if (l <= 740.0) tmp = Float64(exp(Float64(Float64(n - m) + Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) - l))) * cos(Float64(Float64(Float64(n + m) * Float64(0.5 * K)) - M))); else tmp = exp(Float64(-l)); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = 0.5 * (n + m);
tmp = 0.0;
if (l <= 740.0)
tmp = exp(((n - m) + (((t_0 - M) * (M - t_0)) - l))) * cos((((n + m) * (0.5 * K)) - M));
else
tmp = exp(-l);
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, 740.0], N[(N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[(n + m), $MachinePrecision] * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right)\\
\mathbf{if}\;\ell \leq 740:\\
\;\;\;\;e^{\left(n - m\right) + \left(\left(t\_0 - M\right) \cdot \left(M - t\_0\right) - \ell\right)} \cdot \cos \left(\left(n + m\right) \cdot \left(0.5 \cdot K\right) - M\right)\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 740Initial program 76.5%
Simplified76.5%
*-commutative76.5%
associate--l-76.5%
add-sqr-sqrt44.5%
fabs-sqr44.5%
add-sqr-sqrt76.5%
+-commutative76.5%
div-inv76.5%
metadata-eval76.5%
Applied egg-rr76.5%
unpow295.0%
+-commutative95.0%
+-commutative95.0%
Applied egg-rr76.5%
if 740 < l Initial program 75.8%
Simplified75.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Final simplification82.2%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (exp (- l)))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return exp(-l);
}
NOTE: K, m, n, M, and l 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 K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.exp(-l)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return exp(Float64(-l)) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = exp(-l);
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
e^{-\ell}
\end{array}
Initial program 76.3%
Simplified76.3%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in l around inf 34.9%
neg-mul-134.9%
Simplified34.9%
Taylor expanded in M around 0 35.3%
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (cos M))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return cos(M);
}
NOTE: K, m, n, M, and l 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 K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.cos(M)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return cos(M) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M);
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\cos M
\end{array}
Initial program 76.3%
Simplified76.3%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in l around inf 34.9%
neg-mul-134.9%
Simplified34.9%
Taylor expanded in l around 0 6.4%
herbie shell --seed 2024095
(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)))))))