
(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 7 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (- (* (+ m n) 0.5) M))) (* (cos M) (exp (- (- (fabs (- m n)) l) (* t_0 t_0))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = ((m + n) * 0.5) - M;
return cos(M) * exp(((fabs((m - n)) - l) - (t_0 * t_0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
t_0 = ((m + n) * 0.5d0) - m_1
code = cos(m_1) * exp(((abs((m - n)) - l) - (t_0 * t_0)))
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = ((m + n) * 0.5) - M;
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - (t_0 * t_0)));
}
def code(K, m, n, M, l): t_0 = ((m + n) * 0.5) - M return math.cos(M) * math.exp(((math.fabs((m - n)) - l) - (t_0 * t_0)))
function code(K, m, n, M, l) t_0 = Float64(Float64(Float64(m + n) * 0.5) - M) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(t_0 * t_0)))) end
function tmp = code(K, m, n, M, l) t_0 = ((m + n) * 0.5) - M; tmp = cos(M) * exp(((abs((m - n)) - l) - (t_0 * t_0))); end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision]}, N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5 - M\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - t\_0 \cdot t\_0}
\end{array}
\end{array}
Initial program 75.3%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
unpow295.9%
div-inv95.9%
metadata-eval95.9%
div-inv95.9%
metadata-eval95.9%
Applied egg-rr95.9%
Final simplification95.9%
(FPCore (K m n M l)
:precision binary64
(if (<= m -185.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(cos M)
(exp (+ (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (- (fabs (- m n)) l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -185.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (fabs((m - n)) - l)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-185.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) + (abs((m - n)) - l)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -185.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (Math.abs((m - n)) - l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -185.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (math.fabs((m - n)) - l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -185.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) + Float64(abs(Float64(m - n)) - l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -185.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (abs((m - n)) - l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -185.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -185:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(n \cdot 0.5 - M\right) \cdot \left(\left(M - n \cdot 0.5\right) - m\right) + \left(\left|m - n\right| - \ell\right)}\\
\end{array}
\end{array}
if m < -185Initial program 64.4%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
if -185 < m Initial program 78.6%
Taylor expanded in K around 0 94.7%
cos-neg94.7%
Simplified94.7%
Taylor expanded in m around 0 79.6%
+-commutative79.6%
unpow279.6%
distribute-rgt-out83.2%
*-commutative83.2%
*-commutative83.2%
Simplified83.2%
Final simplification87.0%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -2.1e+24) (not (<= M 27.0))) (* (cos M) (exp (- (pow M 2.0)))) (* (exp (- m (+ n l))) (cos (* (* (+ m n) 0.5) K)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -2.1e+24) || !(M <= 27.0)) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = exp((m - (n + l))) * cos((((m + n) * 0.5) * K));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m_1 <= (-2.1d+24)) .or. (.not. (m_1 <= 27.0d0))) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = exp((m - (n + l))) * cos((((m + n) * 0.5d0) * k))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -2.1e+24) || !(M <= 27.0)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp((m - (n + l))) * Math.cos((((m + n) * 0.5) * K));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -2.1e+24) or not (M <= 27.0): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.exp((m - (n + l))) * math.cos((((m + n) * 0.5) * K)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -2.1e+24) || !(M <= 27.0)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(exp(Float64(m - Float64(n + l))) * cos(Float64(Float64(Float64(m + n) * 0.5) * K))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -2.1e+24) || ~((M <= 27.0))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = exp((m - (n + l))) * cos((((m + n) * 0.5) * K)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -2.1e+24], N[Not[LessEqual[M, 27.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -2.1 \cdot 10^{+24} \lor \neg \left(M \leq 27\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{m - \left(n + \ell\right)} \cdot \cos \left(\left(\left(m + n\right) \cdot 0.5\right) \cdot K\right)\\
\end{array}
\end{array}
if M < -2.1000000000000001e24 or 27 < M Initial program 79.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 98.3%
mul-1-neg98.3%
Simplified98.3%
if -2.1000000000000001e24 < M < 27Initial program 71.4%
*-un-lft-identity71.4%
*-commutative71.4%
Applied egg-rr29.2%
Taylor expanded in M around inf 51.4%
Taylor expanded in M around 0 51.4%
*-commutative51.4%
+-commutative51.4%
distribute-lft-in51.4%
distribute-lft-out51.4%
*-commutative51.4%
associate-*l*51.4%
*-commutative51.4%
*-commutative51.4%
associate-*r*51.4%
distribute-lft-in51.4%
*-commutative51.4%
distribute-lft-in51.4%
+-commutative51.4%
Simplified51.4%
Final simplification73.2%
(FPCore (K m n M l) :precision binary64 (if (<= l 720.0) (* (exp (- m (+ n l))) (cos (* (* (+ m n) 0.5) K))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 720.0) {
tmp = exp((m - (n + l))) * cos((((m + n) * 0.5) * K));
} else {
tmp = exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= 720.0d0) then
tmp = exp((m - (n + l))) * cos((((m + n) * 0.5d0) * k))
else
tmp = exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 720.0) {
tmp = Math.exp((m - (n + l))) * Math.cos((((m + n) * 0.5) * K));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 720.0: tmp = math.exp((m - (n + l))) * math.cos((((m + n) * 0.5) * K)) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 720.0) tmp = Float64(exp(Float64(m - Float64(n + l))) * cos(Float64(Float64(Float64(m + n) * 0.5) * K))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 720.0) tmp = exp((m - (n + l))) * cos((((m + n) * 0.5) * K)); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 720.0], N[(N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 720:\\
\;\;\;\;e^{m - \left(n + \ell\right)} \cdot \cos \left(\left(\left(m + n\right) \cdot 0.5\right) \cdot K\right)\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 720Initial program 76.2%
*-un-lft-identity76.2%
*-commutative76.2%
Applied egg-rr14.1%
Taylor expanded in M around inf 28.6%
Taylor expanded in M around 0 36.7%
*-commutative36.7%
+-commutative36.7%
distribute-lft-in36.7%
distribute-lft-out36.7%
*-commutative36.7%
associate-*l*36.7%
*-commutative36.7%
*-commutative36.7%
associate-*r*36.7%
distribute-lft-in36.7%
*-commutative36.7%
distribute-lft-in36.7%
+-commutative36.7%
Simplified36.7%
if 720 < l Initial program 72.4%
add-exp-log39.7%
Applied egg-rr39.7%
Taylor expanded in l around inf 39.7%
mul-1-neg39.7%
Simplified39.7%
Taylor expanded in m around inf 82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in m around 0 100.0%
Final simplification51.0%
(FPCore (K m n M l) :precision binary64 (if (<= m -6.5e-9) (* (cos (- (/ (* (+ m n) K) 2.0) M)) (exp m)) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -6.5e-9) {
tmp = cos(((((m + n) * K) / 2.0) - M)) * exp(m);
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-6.5d-9)) then
tmp = cos(((((m + n) * k) / 2.0d0) - m_1)) * exp(m)
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -6.5e-9) {
tmp = Math.cos(((((m + n) * K) / 2.0) - M)) * Math.exp(m);
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -6.5e-9: tmp = math.cos(((((m + n) * K) / 2.0) - M)) * math.exp(m) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -6.5e-9) tmp = Float64(cos(Float64(Float64(Float64(Float64(m + n) * K) / 2.0) - M)) * exp(m)); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -6.5e-9) tmp = cos(((((m + n) * K) / 2.0) - M)) * exp(m); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -6.5e-9], N[(N[Cos[N[(N[(N[(N[(m + n), $MachinePrecision] * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[m], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -6.5 \cdot 10^{-9}:\\
\;\;\;\;\cos \left(\frac{\left(m + n\right) \cdot K}{2} - M\right) \cdot e^{m}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if m < -6.5000000000000003e-9Initial program 65.0%
*-un-lft-identity65.0%
*-commutative65.0%
Applied egg-rr1.0%
Taylor expanded in M around inf 33.8%
Taylor expanded in m around inf 63.4%
if -6.5000000000000003e-9 < m Initial program 78.5%
Taylor expanded in K around 0 94.7%
cos-neg94.7%
Simplified94.7%
Taylor expanded in l around inf 39.5%
mul-1-neg39.5%
Simplified39.5%
Final simplification45.1%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(-l);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(-l);
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(-l)
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(-l))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(-l); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{-\ell}
\end{array}
Initial program 75.3%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in l around inf 35.1%
mul-1-neg35.1%
Simplified35.1%
(FPCore (K m n M l) :precision binary64 (exp (- l)))
double code(double K, double m, double n, double M, double l) {
return exp(-l);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
def code(K, m, n, M, l): return math.exp(-l)
function code(K, m, n, M, l) return exp(Float64(-l)) end
function tmp = code(K, m, n, M, l) tmp = exp(-l); end
code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
\\
e^{-\ell}
\end{array}
Initial program 75.3%
add-exp-log40.5%
Applied egg-rr40.5%
Taylor expanded in l around inf 17.4%
mul-1-neg17.4%
Simplified17.4%
Taylor expanded in m around inf 30.1%
*-commutative30.1%
Simplified30.1%
Taylor expanded in m around 0 34.3%
Final simplification34.3%
herbie shell --seed 2024100
(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)))))))