
(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 15 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 (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_0) INFINITY)
(* t_0 (cos (- (/ 1.0 (/ (/ 2.0 (+ m n)) K)) M)))
(* t_0 (cos M)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= ((double) INFINITY)) {
tmp = t_0 * cos(((1.0 / ((2.0 / (m + n)) / K)) - M));
} else {
tmp = t_0 * cos(M);
}
return tmp;
}
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((Math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= Double.POSITIVE_INFINITY) {
tmp = t_0 * Math.cos(((1.0 / ((2.0 / (m + n)) / K)) - M));
} else {
tmp = t_0 * Math.cos(M);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0))) tmp = 0 if (math.cos((((K * (m + n)) / 2.0) - M)) * t_0) <= math.inf: tmp = t_0 * math.cos(((1.0 / ((2.0 / (m + n)) / K)) - M)) else: tmp = t_0 * math.cos(M) return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_0) <= Inf) tmp = Float64(t_0 * cos(Float64(Float64(1.0 / Float64(Float64(2.0 / Float64(m + n)) / K)) - M))); else tmp = Float64(t_0 * cos(M)); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); tmp = 0.0; if ((cos((((K * (m + n)) / 2.0) - M)) * t_0) <= Inf) tmp = t_0 * cos(((1.0 / ((2.0 / (m + n)) / K)) - M)); else tmp = t_0 * cos(M); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = 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]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision], Infinity], N[(t$95$0 * N[Cos[N[(N[(1.0 / N[(N[(2.0 / N[(m + n), $MachinePrecision]), $MachinePrecision] / K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Cos[M], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t\_0 \leq \infty:\\
\;\;\;\;t\_0 \cdot \cos \left(\frac{1}{\frac{\frac{2}{m + n}}{K}} - M\right)\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot \cos M\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) < +inf.0Initial program 95.8%
clear-num96.3%
inv-pow96.3%
*-commutative96.3%
Applied egg-rr96.3%
unpow-196.3%
associate-/r*97.2%
Simplified97.2%
if +inf.0 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 0.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Final simplification97.8%
(FPCore (K m n M l) :precision binary64 (* (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0))) (cos M)))
double code(double K, double m, double n, double M, double l) {
return exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0))) * 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 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0))) * cos(m_1)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0))) * Math.cos(M);
}
def code(K, m, n, M, l): return math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0))) * math.cos(M)
function code(K, m, n, M, l) return Float64(exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) * cos(M)) end
function tmp = code(K, m, n, M, l) tmp = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))) * cos(M); end
code[K_, m_, n_, M_, l_] := N[(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] * N[Cos[M], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}} \cdot \cos M
\end{array}
Initial program 75.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Final simplification96.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (+ m n) 0.5)))
(if (<= n 5e+42)
(*
(cos (- (/ (* K n) 2.0) M))
(exp (+ (- (- m n) l) (* (- t_0 M) (- M t_0)))))
(exp (- (- (fabs (- m n)) l) (* 0.25 (pow (+ m n) 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (n <= 5e+42) {
tmp = cos((((K * n) / 2.0) - M)) * exp((((m - n) - l) + ((t_0 - M) * (M - t_0))));
} else {
tmp = exp(((fabs((m - n)) - l) - (0.25 * pow((m + n), 2.0))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = (m + n) * 0.5d0
if (n <= 5d+42) then
tmp = cos((((k * n) / 2.0d0) - m_1)) * exp((((m - n) - l) + ((t_0 - m_1) * (m_1 - t_0))))
else
tmp = exp(((abs((m - n)) - l) - (0.25d0 * ((m + n) ** 2.0d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (n <= 5e+42) {
tmp = Math.cos((((K * n) / 2.0) - M)) * Math.exp((((m - n) - l) + ((t_0 - M) * (M - t_0))));
} else {
tmp = Math.exp(((Math.abs((m - n)) - l) - (0.25 * Math.pow((m + n), 2.0))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (m + n) * 0.5 tmp = 0 if n <= 5e+42: tmp = math.cos((((K * n) / 2.0) - M)) * math.exp((((m - n) - l) + ((t_0 - M) * (M - t_0)))) else: tmp = math.exp(((math.fabs((m - n)) - l) - (0.25 * math.pow((m + n), 2.0)))) return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(m + n) * 0.5) tmp = 0.0 if (n <= 5e+42) tmp = Float64(cos(Float64(Float64(Float64(K * n) / 2.0) - M)) * exp(Float64(Float64(Float64(m - n) - l) + Float64(Float64(t_0 - M) * Float64(M - t_0))))); else tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(0.25 * (Float64(m + n) ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (m + n) * 0.5; tmp = 0.0; if (n <= 5e+42) tmp = cos((((K * n) / 2.0) - M)) * exp((((m - n) - l) + ((t_0 - M) * (M - t_0)))); else tmp = exp(((abs((m - n)) - l) - (0.25 * ((m + n) ^ 2.0)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[n, 5e+42], N[(N[Cos[N[(N[(N[(K * n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] + N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5\\
\mathbf{if}\;n \leq 5 \cdot 10^{+42}:\\
\;\;\;\;\cos \left(\frac{K \cdot n}{2} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) + \left(t\_0 - M\right) \cdot \left(M - t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) - 0.25 \cdot {\left(m + n\right)}^{2}}\\
\end{array}
\end{array}
if n < 5.00000000000000007e42Initial program 77.3%
sub-neg77.3%
distribute-neg-out77.3%
div-inv77.3%
fmm-def77.3%
metadata-eval77.3%
add-sqr-sqrt45.8%
fabs-sqr45.8%
add-sqr-sqrt77.3%
Applied egg-rr77.3%
+-commutative77.3%
distribute-neg-in77.3%
sub-neg77.3%
sub-neg77.3%
distribute-neg-in77.3%
sub-neg77.3%
mul-1-neg77.3%
distribute-neg-in77.3%
mul-1-neg77.3%
mul-1-neg77.3%
remove-double-neg77.3%
distribute-neg-in77.3%
mul-1-neg77.3%
remove-double-neg77.3%
sub-neg77.3%
fmm-undef77.3%
*-commutative77.3%
Simplified77.3%
Taylor expanded in m around 0 85.8%
*-commutative85.8%
Simplified85.8%
unpow285.8%
*-commutative85.8%
*-commutative85.8%
Applied egg-rr85.8%
if 5.00000000000000007e42 < n Initial program 69.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 97.8%
associate--r+97.8%
Simplified97.8%
Final simplification88.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (+ m n) 0.5)))
(if (<= n 8e+38)
(*
(cos (- (/ (* K n) 2.0) M))
(exp (+ (- (- m n) l) (* (- t_0 M) (- M t_0)))))
(exp (* -0.25 (pow n 2.0))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (n <= 8e+38) {
tmp = cos((((K * n) / 2.0) - M)) * exp((((m - n) - l) + ((t_0 - M) * (M - t_0))));
} else {
tmp = exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = (m + n) * 0.5d0
if (n <= 8d+38) then
tmp = cos((((k * n) / 2.0d0) - m_1)) * exp((((m - n) - l) + ((t_0 - m_1) * (m_1 - t_0))))
else
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (n <= 8e+38) {
tmp = Math.cos((((K * n) / 2.0) - M)) * Math.exp((((m - n) - l) + ((t_0 - M) * (M - t_0))));
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (m + n) * 0.5 tmp = 0 if n <= 8e+38: tmp = math.cos((((K * n) / 2.0) - M)) * math.exp((((m - n) - l) + ((t_0 - M) * (M - t_0)))) else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(m + n) * 0.5) tmp = 0.0 if (n <= 8e+38) tmp = Float64(cos(Float64(Float64(Float64(K * n) / 2.0) - M)) * exp(Float64(Float64(Float64(m - n) - l) + Float64(Float64(t_0 - M) * Float64(M - t_0))))); else tmp = exp(Float64(-0.25 * (n ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (m + n) * 0.5; tmp = 0.0; if (n <= 8e+38) tmp = cos((((K * n) / 2.0) - M)) * exp((((m - n) - l) + ((t_0 - M) * (M - t_0)))); else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[n, 8e+38], N[(N[Cos[N[(N[(N[(K * n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] + N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5\\
\mathbf{if}\;n \leq 8 \cdot 10^{+38}:\\
\;\;\;\;\cos \left(\frac{K \cdot n}{2} - M\right) \cdot e^{\left(\left(m - n\right) - \ell\right) + \left(t\_0 - M\right) \cdot \left(M - t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 7.99999999999999982e38Initial program 77.2%
sub-neg77.2%
distribute-neg-out77.2%
div-inv77.2%
fmm-def77.2%
metadata-eval77.2%
add-sqr-sqrt46.0%
fabs-sqr46.0%
add-sqr-sqrt77.2%
Applied egg-rr77.2%
+-commutative77.2%
distribute-neg-in77.2%
sub-neg77.2%
sub-neg77.2%
distribute-neg-in77.2%
sub-neg77.2%
mul-1-neg77.2%
distribute-neg-in77.2%
mul-1-neg77.2%
mul-1-neg77.2%
remove-double-neg77.2%
distribute-neg-in77.2%
mul-1-neg77.2%
remove-double-neg77.2%
sub-neg77.2%
fmm-undef77.2%
*-commutative77.2%
Simplified77.2%
Taylor expanded in m around 0 85.7%
*-commutative85.7%
Simplified85.7%
unpow285.7%
*-commutative85.7%
*-commutative85.7%
Applied egg-rr85.7%
if 7.99999999999999982e38 < n Initial program 70.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 95.8%
Taylor expanded in M around 0 95.8%
Final simplification87.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (+ m n) 0.5)))
(if (<= n 5e+48)
(* (cos (- (/ (* K n) 2.0) M)) (exp (- (* (- t_0 M) (- M t_0)) n)))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (n <= 5e+48) {
tmp = cos((((K * n) / 2.0) - M)) * exp((((t_0 - M) * (M - t_0)) - n));
} else {
tmp = cos(M) * exp((-0.25 * (n * 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 = (m + n) * 0.5d0
if (n <= 5d+48) then
tmp = cos((((k * n) / 2.0d0) - m_1)) * exp((((t_0 - m_1) * (m_1 - t_0)) - n))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (n <= 5e+48) {
tmp = Math.cos((((K * n) / 2.0) - M)) * Math.exp((((t_0 - M) * (M - t_0)) - n));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (m + n) * 0.5 tmp = 0 if n <= 5e+48: tmp = math.cos((((K * n) / 2.0) - M)) * math.exp((((t_0 - M) * (M - t_0)) - n)) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(m + n) * 0.5) tmp = 0.0 if (n <= 5e+48) tmp = Float64(cos(Float64(Float64(Float64(K * n) / 2.0) - M)) * exp(Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) - n))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (m + n) * 0.5; tmp = 0.0; if (n <= 5e+48) tmp = cos((((K * n) / 2.0) - M)) * exp((((t_0 - M) * (M - t_0)) - n)); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[n, 5e+48], N[(N[Cos[N[(N[(N[(K * n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5\\
\mathbf{if}\;n \leq 5 \cdot 10^{+48}:\\
\;\;\;\;\cos \left(\frac{K \cdot n}{2} - M\right) \cdot e^{\left(t\_0 - M\right) \cdot \left(M - t\_0\right) - n}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 4.99999999999999973e48Initial program 77.5%
sub-neg77.5%
distribute-neg-out77.5%
div-inv77.5%
fmm-def77.5%
metadata-eval77.5%
add-sqr-sqrt45.4%
fabs-sqr45.4%
add-sqr-sqrt77.5%
Applied egg-rr77.5%
+-commutative77.5%
distribute-neg-in77.5%
sub-neg77.5%
sub-neg77.5%
distribute-neg-in77.5%
sub-neg77.5%
mul-1-neg77.5%
distribute-neg-in77.5%
mul-1-neg77.5%
mul-1-neg77.5%
remove-double-neg77.5%
distribute-neg-in77.5%
mul-1-neg77.5%
remove-double-neg77.5%
sub-neg77.5%
fmm-undef77.5%
*-commutative77.5%
Simplified77.5%
Taylor expanded in m around 0 86.0%
*-commutative86.0%
Simplified86.0%
unpow286.0%
*-commutative86.0%
*-commutative86.0%
Applied egg-rr86.0%
Taylor expanded in n around inf 78.9%
mul-1-neg78.9%
Simplified78.9%
if 4.99999999999999973e48 < n Initial program 68.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 95.5%
unpow295.5%
Applied egg-rr95.5%
Final simplification81.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* -0.25 (* n n))))))
(if (<= l -4.5e-182)
t_0
(if (<= l 1.3e-171)
(* (* 0.5 (pow l 2.0)) (cos (- (* (+ m n) (* K 0.5)) M)))
(if (<= l 2.4e-23) t_0 (* (cos M) (exp (- l))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((-0.25 * (n * n)));
double tmp;
if (l <= -4.5e-182) {
tmp = t_0;
} else if (l <= 1.3e-171) {
tmp = (0.5 * pow(l, 2.0)) * cos((((m + n) * (K * 0.5)) - M));
} else if (l <= 2.4e-23) {
tmp = t_0;
} 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) :: t_0
real(8) :: tmp
t_0 = cos(m_1) * exp(((-0.25d0) * (n * n)))
if (l <= (-4.5d-182)) then
tmp = t_0
else if (l <= 1.3d-171) then
tmp = (0.5d0 * (l ** 2.0d0)) * cos((((m + n) * (k * 0.5d0)) - m_1))
else if (l <= 2.4d-23) then
tmp = t_0
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 t_0 = Math.cos(M) * Math.exp((-0.25 * (n * n)));
double tmp;
if (l <= -4.5e-182) {
tmp = t_0;
} else if (l <= 1.3e-171) {
tmp = (0.5 * Math.pow(l, 2.0)) * Math.cos((((m + n) * (K * 0.5)) - M));
} else if (l <= 2.4e-23) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((-0.25 * (n * n))) tmp = 0 if l <= -4.5e-182: tmp = t_0 elif l <= 1.3e-171: tmp = (0.5 * math.pow(l, 2.0)) * math.cos((((m + n) * (K * 0.5)) - M)) elif l <= 2.4e-23: tmp = t_0 else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))) tmp = 0.0 if (l <= -4.5e-182) tmp = t_0; elseif (l <= 1.3e-171) tmp = Float64(Float64(0.5 * (l ^ 2.0)) * cos(Float64(Float64(Float64(m + n) * Float64(K * 0.5)) - M))); elseif (l <= 2.4e-23) tmp = t_0; else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp((-0.25 * (n * n))); tmp = 0.0; if (l <= -4.5e-182) tmp = t_0; elseif (l <= 1.3e-171) tmp = (0.5 * (l ^ 2.0)) * cos((((m + n) * (K * 0.5)) - M)); elseif (l <= 2.4e-23) tmp = t_0; else tmp = cos(M) * 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[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.5e-182], t$95$0, If[LessEqual[l, 1.3e-171], N[(N[(0.5 * N[Power[l, 2.0], $MachinePrecision]), $MachinePrecision] * N[Cos[N[(N[(N[(m + n), $MachinePrecision] * N[(K * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.4e-23], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{if}\;\ell \leq -4.5 \cdot 10^{-182}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;\ell \leq 1.3 \cdot 10^{-171}:\\
\;\;\;\;\left(0.5 \cdot {\ell}^{2}\right) \cdot \cos \left(\left(m + n\right) \cdot \left(K \cdot 0.5\right) - M\right)\\
\mathbf{elif}\;\ell \leq 2.4 \cdot 10^{-23}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -4.4999999999999999e-182 or 1.30000000000000002e-171 < l < 2.39999999999999996e-23Initial program 75.6%
Taylor expanded in K around 0 94.2%
cos-neg94.2%
Simplified94.2%
Taylor expanded in n around inf 47.5%
unpow247.5%
Applied egg-rr47.5%
if -4.4999999999999999e-182 < l < 1.30000000000000002e-171Initial program 80.7%
Taylor expanded in l around inf 11.8%
mul-1-neg11.8%
Simplified11.8%
Taylor expanded in l around 0 11.8%
Taylor expanded in l around inf 71.0%
associate-*r*71.0%
associate-*r*71.0%
+-commutative71.0%
Simplified71.0%
if 2.39999999999999996e-23 < l Initial program 72.7%
Taylor expanded in l around inf 70.2%
mul-1-neg70.2%
Simplified70.2%
Taylor expanded in K around 0 95.0%
cos-neg95.0%
Simplified95.0%
Final simplification67.4%
(FPCore (K m n M l)
:precision binary64
(if (<= n -55.0)
(exp (* -0.25 (pow n 2.0)))
(if (<= n 13.5)
(* (exp (- l)) (cos (- (* K (/ 1.0 (/ 2.0 n))) M)))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -55.0) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else if (n <= 13.5) {
tmp = exp(-l) * cos(((K * (1.0 / (2.0 / n))) - M));
} else {
tmp = cos(M) * exp((-0.25 * (n * 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 <= (-55.0d0)) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else if (n <= 13.5d0) then
tmp = exp(-l) * cos(((k * (1.0d0 / (2.0d0 / n))) - m_1))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * 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 <= -55.0) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else if (n <= 13.5) {
tmp = Math.exp(-l) * Math.cos(((K * (1.0 / (2.0 / n))) - M));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -55.0: tmp = math.exp((-0.25 * math.pow(n, 2.0))) elif n <= 13.5: tmp = math.exp(-l) * math.cos(((K * (1.0 / (2.0 / n))) - M)) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -55.0) tmp = exp(Float64(-0.25 * (n ^ 2.0))); elseif (n <= 13.5) tmp = Float64(exp(Float64(-l)) * cos(Float64(Float64(K * Float64(1.0 / Float64(2.0 / n))) - M))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -55.0) tmp = exp((-0.25 * (n ^ 2.0))); elseif (n <= 13.5) tmp = exp(-l) * cos(((K * (1.0 / (2.0 / n))) - M)); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -55.0], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 13.5], N[(N[Exp[(-l)], $MachinePrecision] * N[Cos[N[(N[(K * N[(1.0 / N[(2.0 / n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -55:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{elif}\;n \leq 13.5:\\
\;\;\;\;e^{-\ell} \cdot \cos \left(K \cdot \frac{1}{\frac{2}{n}} - M\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < -55Initial program 59.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in n around inf 95.6%
Taylor expanded in M around 0 95.6%
if -55 < n < 13.5Initial program 85.0%
Taylor expanded in l around inf 37.8%
mul-1-neg37.8%
Simplified37.8%
clear-num85.0%
inv-pow85.0%
*-commutative85.0%
Applied egg-rr37.8%
unpow-185.0%
associate-/r*85.8%
Simplified38.6%
associate-/r/37.9%
+-commutative37.9%
Applied egg-rr37.9%
Taylor expanded in n around inf 40.9%
if 13.5 < n Initial program 74.1%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in n around inf 91.5%
unpow291.5%
Applied egg-rr91.5%
Final simplification66.7%
(FPCore (K m n M l)
:precision binary64
(if (<= n -54.0)
(exp (* -0.25 (pow n 2.0)))
(if (<= n 13.5)
(* (cos (- (/ (* K n) 2.0) M)) (exp (- l)))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -54.0) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else if (n <= 13.5) {
tmp = cos((((K * n) / 2.0) - M)) * exp(-l);
} else {
tmp = cos(M) * exp((-0.25 * (n * 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 <= (-54.0d0)) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else if (n <= 13.5d0) then
tmp = cos((((k * n) / 2.0d0) - m_1)) * exp(-l)
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * 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 <= -54.0) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else if (n <= 13.5) {
tmp = Math.cos((((K * n) / 2.0) - M)) * Math.exp(-l);
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -54.0: tmp = math.exp((-0.25 * math.pow(n, 2.0))) elif n <= 13.5: tmp = math.cos((((K * n) / 2.0) - M)) * math.exp(-l) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -54.0) tmp = exp(Float64(-0.25 * (n ^ 2.0))); elseif (n <= 13.5) tmp = Float64(cos(Float64(Float64(Float64(K * n) / 2.0) - M)) * exp(Float64(-l))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -54.0) tmp = exp((-0.25 * (n ^ 2.0))); elseif (n <= 13.5) tmp = cos((((K * n) / 2.0) - M)) * exp(-l); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -54.0], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 13.5], N[(N[Cos[N[(N[(N[(K * n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -54:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{elif}\;n \leq 13.5:\\
\;\;\;\;\cos \left(\frac{K \cdot n}{2} - M\right) \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < -54Initial program 59.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in n around inf 95.6%
Taylor expanded in M around 0 95.6%
if -54 < n < 13.5Initial program 85.0%
Taylor expanded in l around inf 37.8%
mul-1-neg37.8%
Simplified37.8%
Taylor expanded in m around 0 40.9%
*-commutative94.8%
Simplified40.9%
if 13.5 < n Initial program 74.1%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in n around inf 91.5%
unpow291.5%
Applied egg-rr91.5%
Final simplification66.7%
(FPCore (K m n M l)
:precision binary64
(if (<= n -54.0)
(exp (* -0.25 (pow n 2.0)))
(if (<= n 4.6e-10)
(* (cos M) (exp (- l)))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -54.0) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else if (n <= 4.6e-10) {
tmp = cos(M) * exp(-l);
} else {
tmp = cos(M) * exp((-0.25 * (n * 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 <= (-54.0d0)) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else if (n <= 4.6d-10) then
tmp = cos(m_1) * exp(-l)
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * 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 <= -54.0) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else if (n <= 4.6e-10) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -54.0: tmp = math.exp((-0.25 * math.pow(n, 2.0))) elif n <= 4.6e-10: tmp = math.cos(M) * math.exp(-l) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -54.0) tmp = exp(Float64(-0.25 * (n ^ 2.0))); elseif (n <= 4.6e-10) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -54.0) tmp = exp((-0.25 * (n ^ 2.0))); elseif (n <= 4.6e-10) tmp = cos(M) * exp(-l); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -54.0], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 4.6e-10], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -54:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{elif}\;n \leq 4.6 \cdot 10^{-10}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < -54Initial program 59.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in n around inf 95.6%
Taylor expanded in M around 0 95.6%
if -54 < n < 4.60000000000000014e-10Initial program 84.8%
Taylor expanded in l around inf 38.4%
mul-1-neg38.4%
Simplified38.4%
Taylor expanded in K around 0 40.9%
cos-neg40.9%
Simplified40.9%
if 4.60000000000000014e-10 < n Initial program 75.0%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in n around inf 88.6%
unpow288.6%
Applied egg-rr88.6%
(FPCore (K m n M l) :precision binary64 (if (or (<= n -54.0) (not (<= n 4.6e-10))) (exp (* -0.25 (pow n 2.0))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -54.0) || !(n <= 4.6e-10)) {
tmp = exp((-0.25 * pow(n, 2.0)));
} 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 ((n <= (-54.0d0)) .or. (.not. (n <= 4.6d-10))) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
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 ((n <= -54.0) || !(n <= 4.6e-10)) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -54.0) or not (n <= 4.6e-10): tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -54.0) || !(n <= 4.6e-10)) tmp = exp(Float64(-0.25 * (n ^ 2.0))); 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 ((n <= -54.0) || ~((n <= 4.6e-10))) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -54.0], N[Not[LessEqual[n, 4.6e-10]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -54 \lor \neg \left(n \leq 4.6 \cdot 10^{-10}\right):\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if n < -54 or 4.60000000000000014e-10 < n Initial program 66.9%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in n around inf 92.3%
Taylor expanded in M around 0 92.3%
if -54 < n < 4.60000000000000014e-10Initial program 84.8%
Taylor expanded in l around inf 38.4%
mul-1-neg38.4%
Simplified38.4%
Taylor expanded in K around 0 40.9%
cos-neg40.9%
Simplified40.9%
Final simplification66.4%
(FPCore (K m n M l) :precision binary64 (exp (* -0.25 (pow n 2.0))))
double code(double K, double m, double n, double M, double l) {
return exp((-0.25 * pow(n, 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 = exp(((-0.25d0) * (n ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((-0.25 * Math.pow(n, 2.0)));
}
def code(K, m, n, M, l): return math.exp((-0.25 * math.pow(n, 2.0)))
function code(K, m, n, M, l) return exp(Float64(-0.25 * (n ^ 2.0))) end
function tmp = code(K, m, n, M, l) tmp = exp((-0.25 * (n ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{-0.25 \cdot {n}^{2}}
\end{array}
Initial program 75.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in n around inf 51.9%
Taylor expanded in M around 0 51.9%
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.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((((k * (m + n)) / 2.0d0) - m_1)) * (1.0d0 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0))))
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)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))); 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[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)\right)
\end{array}
Initial program 75.9%
Taylor expanded in l around inf 30.1%
mul-1-neg30.1%
Simplified30.1%
Taylor expanded in l around 0 9.4%
Final simplification9.4%
(FPCore (K m n M l) :precision binary64 (* (cos M) (+ 1.0 (* l (+ (* l 0.5) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * (1.0 + (l * ((l * 0.5) + -1.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) * (1.0d0 + (l * ((l * 0.5d0) + (-1.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * (1.0 + (l * ((l * 0.5) + -1.0)));
}
def code(K, m, n, M, l): return math.cos(M) * (1.0 + (l * ((l * 0.5) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(M) * Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * (1.0 + (l * ((l * 0.5) + -1.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)\right)
\end{array}
Initial program 75.9%
Taylor expanded in l around inf 30.1%
mul-1-neg30.1%
Simplified30.1%
Taylor expanded in l around 0 8.4%
Taylor expanded in K around 0 9.2%
cos-neg96.2%
Simplified9.2%
Final simplification9.2%
(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 75.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in n around inf 51.9%
Taylor expanded in n around 0 7.5%
Taylor expanded in M around inf 7.5%
(FPCore (K m n M l) :precision binary64 1.0)
double code(double K, double m, double n, double M, double l) {
return 1.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 = 1.0d0
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0;
}
def code(K, m, n, M, l): return 1.0
function code(K, m, n, M, l) return 1.0 end
function tmp = code(K, m, n, M, l) tmp = 1.0; end
code[K_, m_, n_, M_, l_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 75.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in n around inf 51.9%
Taylor expanded in n around 0 7.5%
Taylor expanded in M around 0 7.5%
herbie shell --seed 2024152
(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)))))))