
(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}
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
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)));
}
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
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)));
}
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)))
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
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
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}
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 81.4%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (- m n) l) (pow (- (* (+ m n) 0.5) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((((m - n) - l) - pow((((m + n) * 0.5) - M), 2.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp((((m - n) - l) - ((((m + n) * 0.5d0) - m_1) ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((((m - n) - l) - Math.pow((((m + n) * 0.5) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((((m - n) - l) - math.pow((((m + n) * 0.5) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(Float64(m - n) - l) - (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((((m - n) - l) - ((((m + n) * 0.5) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}
\end{array}
Initial program 81.4%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
sub-neg98.0%
distribute-neg-out98.0%
div-inv98.0%
metadata-eval98.0%
add-sqr-sqrt47.9%
fabs-sqr47.9%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
Final simplification98.0%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (- m n) l) (pow (- (* n 0.5) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((((m - n) - l) - pow(((n * 0.5) - M), 2.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp((((m - n) - l) - (((n * 0.5d0) - m_1) ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((((m - n) - l) - Math.pow(((n * 0.5) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((((m - n) - l) - math.pow(((n * 0.5) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(Float64(m - n) - l) - (Float64(Float64(n * 0.5) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((((m - n) - l) - (((n * 0.5) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(n \cdot 0.5 - M\right)}^{2}}
\end{array}
Initial program 81.4%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in m around 0 82.2%
associate--r+82.2%
fabs-sub82.2%
sub-neg82.2%
mul-1-neg82.2%
fabs-neg82.2%
fabs-neg82.2%
mul-1-neg82.2%
sub-neg82.2%
fabs-sub82.2%
unpow182.2%
sqr-pow40.2%
fabs-sqr40.2%
sqr-pow89.2%
unpow189.2%
*-commutative89.2%
Simplified89.2%
Final simplification89.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- n)))))
(if (<= m -54.0)
(pow (exp m) (* m -0.25))
(if (<= m -1.25e-134)
t_0
(if (<= m -2.9e-178)
(/ (cos M) (exp l))
(if (or (<= m 2.6e-290) (not (<= m 7.1e-227))) t_0 (exp (- l))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-n);
double tmp;
if (m <= -54.0) {
tmp = pow(exp(m), (m * -0.25));
} else if (m <= -1.25e-134) {
tmp = t_0;
} else if (m <= -2.9e-178) {
tmp = cos(M) / exp(l);
} else if ((m <= 2.6e-290) || !(m <= 7.1e-227)) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = cos(m_1) * exp(-n)
if (m <= (-54.0d0)) then
tmp = exp(m) ** (m * (-0.25d0))
else if (m <= (-1.25d-134)) then
tmp = t_0
else if (m <= (-2.9d-178)) then
tmp = cos(m_1) / exp(l)
else if ((m <= 2.6d-290) .or. (.not. (m <= 7.1d-227))) then
tmp = t_0
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 t_0 = Math.cos(M) * Math.exp(-n);
double tmp;
if (m <= -54.0) {
tmp = Math.pow(Math.exp(m), (m * -0.25));
} else if (m <= -1.25e-134) {
tmp = t_0;
} else if (m <= -2.9e-178) {
tmp = Math.cos(M) / Math.exp(l);
} else if ((m <= 2.6e-290) || !(m <= 7.1e-227)) {
tmp = t_0;
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-n) tmp = 0 if m <= -54.0: tmp = math.pow(math.exp(m), (m * -0.25)) elif m <= -1.25e-134: tmp = t_0 elif m <= -2.9e-178: tmp = math.cos(M) / math.exp(l) elif (m <= 2.6e-290) or not (m <= 7.1e-227): tmp = t_0 else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-n))) tmp = 0.0 if (m <= -54.0) tmp = exp(m) ^ Float64(m * -0.25); elseif (m <= -1.25e-134) tmp = t_0; elseif (m <= -2.9e-178) tmp = Float64(cos(M) / exp(l)); elseif ((m <= 2.6e-290) || !(m <= 7.1e-227)) tmp = t_0; else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-n); tmp = 0.0; if (m <= -54.0) tmp = exp(m) ^ (m * -0.25); elseif (m <= -1.25e-134) tmp = t_0; elseif (m <= -2.9e-178) tmp = cos(M) / exp(l); elseif ((m <= 2.6e-290) || ~((m <= 7.1e-227))) tmp = t_0; else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-n)], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -54.0], N[Power[N[Exp[m], $MachinePrecision], N[(m * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -1.25e-134], t$95$0, If[LessEqual[m, -2.9e-178], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, 2.6e-290], N[Not[LessEqual[m, 7.1e-227]], $MachinePrecision]], t$95$0, N[Exp[(-l)], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-n}\\
\mathbf{if}\;m \leq -54:\\
\;\;\;\;{\left(e^{m}\right)}^{\left(m \cdot -0.25\right)}\\
\mathbf{elif}\;m \leq -1.25 \cdot 10^{-134}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;m \leq -2.9 \cdot 10^{-178}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{elif}\;m \leq 2.6 \cdot 10^{-290} \lor \neg \left(m \leq 7.1 \cdot 10^{-227}\right):\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if m < -54Initial program 69.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 98.1%
*-commutative68.0%
unpow268.0%
Simplified98.1%
Taylor expanded in M around 0 98.1%
*-commutative98.1%
unpow298.1%
associate-*r*98.1%
exp-prod98.1%
Simplified98.1%
if -54 < m < -1.2500000000000001e-134 or -2.8999999999999998e-178 < m < 2.60000000000000001e-290 or 7.0999999999999996e-227 < m Initial program 83.7%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
sub-neg97.1%
distribute-neg-out97.1%
div-inv97.1%
metadata-eval97.1%
add-sqr-sqrt60.6%
fabs-sqr60.6%
add-sqr-sqrt97.1%
Applied egg-rr97.1%
Taylor expanded in M around inf 72.5%
unpow272.5%
Simplified72.5%
Taylor expanded in n around inf 33.4%
if -1.2500000000000001e-134 < m < -2.8999999999999998e-178Initial program 83.3%
Taylor expanded in l around inf 59.1%
mul-1-neg59.1%
Simplified59.1%
Taylor expanded in K around 0 67.6%
cos-neg67.6%
Simplified67.6%
Taylor expanded in l around -inf 67.6%
neg-mul-167.6%
exp-neg67.6%
associate-*r/67.6%
*-rgt-identity67.6%
Simplified67.6%
if 2.60000000000000001e-290 < m < 7.0999999999999996e-227Initial program 93.3%
Taylor expanded in l around inf 34.8%
mul-1-neg34.8%
Simplified34.8%
Taylor expanded in K around 0 35.0%
cos-neg35.0%
Simplified35.0%
Taylor expanded in M around 0 35.0%
Final simplification48.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp m))))
(if (<= n -6.6e-286)
t_0
(if (<= n 1.65e-295)
(exp (- l))
(if (<= n 1.1e-264)
t_0
(if (<= n 720.0)
(* (cos M) (exp (* M (- M))))
(* (cos M) (exp (- n)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(m);
double tmp;
if (n <= -6.6e-286) {
tmp = t_0;
} else if (n <= 1.65e-295) {
tmp = exp(-l);
} else if (n <= 1.1e-264) {
tmp = t_0;
} else if (n <= 720.0) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = cos(M) * exp(-n);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = cos(m_1) * exp(m)
if (n <= (-6.6d-286)) then
tmp = t_0
else if (n <= 1.65d-295) then
tmp = exp(-l)
else if (n <= 1.1d-264) then
tmp = t_0
else if (n <= 720.0d0) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = cos(m_1) * exp(-n)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos(M) * Math.exp(m);
double tmp;
if (n <= -6.6e-286) {
tmp = t_0;
} else if (n <= 1.65e-295) {
tmp = Math.exp(-l);
} else if (n <= 1.1e-264) {
tmp = t_0;
} else if (n <= 720.0) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.cos(M) * Math.exp(-n);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(m) tmp = 0 if n <= -6.6e-286: tmp = t_0 elif n <= 1.65e-295: tmp = math.exp(-l) elif n <= 1.1e-264: tmp = t_0 elif n <= 720.0: tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.cos(M) * math.exp(-n) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(m)) tmp = 0.0 if (n <= -6.6e-286) tmp = t_0; elseif (n <= 1.65e-295) tmp = exp(Float64(-l)); elseif (n <= 1.1e-264) tmp = t_0; elseif (n <= 720.0) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = Float64(cos(M) * exp(Float64(-n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(m); tmp = 0.0; if (n <= -6.6e-286) tmp = t_0; elseif (n <= 1.65e-295) tmp = exp(-l); elseif (n <= 1.1e-264) tmp = t_0; elseif (n <= 720.0) tmp = cos(M) * exp((M * -M)); else tmp = cos(M) * exp(-n); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[m], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -6.6e-286], t$95$0, If[LessEqual[n, 1.65e-295], N[Exp[(-l)], $MachinePrecision], If[LessEqual[n, 1.1e-264], t$95$0, If[LessEqual[n, 720.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-n)], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{m}\\
\mathbf{if}\;n \leq -6.6 \cdot 10^{-286}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.65 \cdot 10^{-295}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{elif}\;n \leq 1.1 \cdot 10^{-264}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 720:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-n}\\
\end{array}
\end{array}
if n < -6.5999999999999997e-286 or 1.6499999999999999e-295 < n < 1.09999999999999997e-264Initial program 83.5%
Taylor expanded in K around 0 98.2%
cos-neg98.2%
Simplified98.2%
sub-neg98.2%
distribute-neg-out98.2%
div-inv98.2%
metadata-eval98.2%
add-sqr-sqrt75.1%
fabs-sqr75.1%
add-sqr-sqrt98.2%
Applied egg-rr98.2%
Taylor expanded in M around inf 64.6%
unpow264.6%
Simplified64.6%
Taylor expanded in m around inf 29.1%
mul-1-neg29.1%
Simplified29.1%
if -6.5999999999999997e-286 < n < 1.6499999999999999e-295Initial program 100.0%
Taylor expanded in l around inf 83.9%
mul-1-neg83.9%
Simplified83.9%
Taylor expanded in K around 0 83.9%
cos-neg83.9%
Simplified83.9%
Taylor expanded in M around 0 83.9%
if 1.09999999999999997e-264 < n < 720Initial program 91.9%
Taylor expanded in K around 0 95.3%
cos-neg95.3%
Simplified95.3%
Taylor expanded in M around inf 67.3%
mul-1-neg67.3%
unpow267.3%
distribute-rgt-neg-in67.3%
Simplified67.3%
if 720 < n Initial program 66.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
sub-neg100.0%
distribute-neg-out100.0%
div-inv100.0%
metadata-eval100.0%
add-sqr-sqrt9.2%
fabs-sqr9.2%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
Taylor expanded in M around inf 92.4%
unpow292.4%
Simplified92.4%
Taylor expanded in n around inf 100.0%
Final simplification57.2%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (- m n) l) (* M M)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((((m - n) - l) - (M * M)));
}
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((((m - n) - l) - (m_1 * m_1)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((((m - n) - l) - (M * M)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((((m - n) - l) - (M * M)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(Float64(m - n) - l) - Float64(M * M)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((((m - n) - l) - (M * M))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left(m - n\right) - \ell\right) - M \cdot M}
\end{array}
Initial program 81.4%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
sub-neg98.0%
distribute-neg-out98.0%
div-inv98.0%
metadata-eval98.0%
add-sqr-sqrt47.9%
fabs-sqr47.9%
add-sqr-sqrt98.0%
Applied egg-rr98.0%
Taylor expanded in M around inf 77.6%
unpow277.6%
Simplified77.6%
Final simplification77.6%
(FPCore (K m n M l) :precision binary64 (if (<= n 3.5e-6) (exp (- l)) (* (cos M) (exp (- n)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 3.5e-6) {
tmp = exp(-l);
} else {
tmp = cos(M) * exp(-n);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 3.5d-6) then
tmp = exp(-l)
else
tmp = cos(m_1) * exp(-n)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 3.5e-6) {
tmp = Math.exp(-l);
} else {
tmp = Math.cos(M) * Math.exp(-n);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 3.5e-6: tmp = math.exp(-l) else: tmp = math.cos(M) * math.exp(-n) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 3.5e-6) tmp = exp(Float64(-l)); else tmp = Float64(cos(M) * exp(Float64(-n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 3.5e-6) tmp = exp(-l); else tmp = cos(M) * exp(-n); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 3.5e-6], N[Exp[(-l)], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-n)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 3.5 \cdot 10^{-6}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-n}\\
\end{array}
\end{array}
if n < 3.49999999999999995e-6Initial program 86.5%
Taylor expanded in l around inf 39.1%
mul-1-neg39.1%
Simplified39.1%
Taylor expanded in K around 0 42.2%
cos-neg42.2%
Simplified42.2%
Taylor expanded in M around 0 42.8%
if 3.49999999999999995e-6 < n Initial program 67.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
sub-neg100.0%
distribute-neg-out100.0%
div-inv100.0%
metadata-eval100.0%
add-sqr-sqrt9.0%
fabs-sqr9.0%
add-sqr-sqrt100.0%
Applied egg-rr100.0%
Taylor expanded in M around inf 92.7%
unpow292.7%
Simplified92.7%
Taylor expanded in n around inf 97.1%
Final simplification57.0%
(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 81.4%
Taylor expanded in l around inf 34.7%
mul-1-neg34.7%
Simplified34.7%
Taylor expanded in K around 0 38.7%
cos-neg38.7%
Simplified38.7%
Taylor expanded in M around 0 39.1%
Final simplification39.1%
(FPCore (K m n M l) :precision binary64 (cos M))
double code(double K, double m, double n, double M, double l) {
return cos(M);
}
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
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
def code(K, m, n, M, l): return math.cos(M)
function code(K, m, n, M, l) return cos(M) end
function tmp = code(K, m, n, M, l) tmp = cos(M); end
code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
\\
\cos M
\end{array}
Initial program 81.4%
Taylor expanded in m around inf 41.6%
*-commutative41.6%
unpow241.6%
Simplified41.6%
Taylor expanded in m around 0 9.6%
*-commutative9.6%
associate-*l*9.6%
Simplified9.6%
Taylor expanded in K around 0 9.8%
cos-neg9.8%
Simplified9.8%
Final simplification9.8%
(FPCore (K m n M l) :precision binary64 (- 1.0 l))
double code(double K, double m, double n, double M, double l) {
return 1.0 - l;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = 1.0d0 - l
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0 - l;
}
def code(K, m, n, M, l): return 1.0 - l
function code(K, m, n, M, l) return Float64(1.0 - l) end
function tmp = code(K, m, n, M, l) tmp = 1.0 - l; end
code[K_, m_, n_, M_, l_] := N[(1.0 - l), $MachinePrecision]
\begin{array}{l}
\\
1 - \ell
\end{array}
Initial program 81.4%
Taylor expanded in l around inf 34.7%
mul-1-neg34.7%
Simplified34.7%
Taylor expanded in m around inf 37.4%
*-commutative37.4%
*-commutative37.4%
associate-*l*37.4%
Simplified37.4%
Taylor expanded in l around 0 9.4%
associate-*r*9.4%
*-commutative9.4%
*-lft-identity9.4%
associate-*r*9.4%
neg-mul-19.4%
associate-*r*9.4%
*-commutative9.4%
distribute-rgt-out9.4%
*-commutative9.4%
associate-*r*9.4%
*-commutative9.4%
sub-neg9.4%
Simplified9.4%
Taylor expanded in m around 0 9.7%
Final simplification9.7%
herbie shell --seed 2023278
(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)))))))