
(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 17 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) 2e-98)
(* t_0 (log (exp (cos (fma K (* (+ m n) 0.5) (- 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) <= 2e-98) {
tmp = t_0 * log(exp(cos(fma(K, ((m + n) * 0.5), -M))));
} else {
tmp = t_0 * 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) <= 2e-98) tmp = Float64(t_0 * log(exp(cos(fma(K, Float64(Float64(m + n) * 0.5), Float64(-M)))))); else tmp = Float64(t_0 * cos(M)); end return 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], 2e-98], N[(t$95$0 * N[Log[N[Exp[N[Cos[N[(K * N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] + (-M)), $MachinePrecision]], $MachinePrecision]], $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 2 \cdot 10^{-98}:\\
\;\;\;\;t\_0 \cdot \log \left(e^{\cos \left(\mathsf{fma}\left(K, \left(m + n\right) \cdot 0.5, -M\right)\right)}\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)))))) < 1.99999999999999988e-98Initial program 98.2%
add-log-exp98.2%
associate-/l*98.2%
fma-neg98.2%
div-inv98.2%
metadata-eval98.2%
Applied egg-rr98.2%
if 1.99999999999999988e-98 < (*.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 28.6%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Final simplification97.9%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (+ m n) 0.5))
(t_1 (cbrt (- t_0 M)))
(t_2 (- (fabs (- m n)) l))
(t_3 (exp (- t_2 (pow (- (/ (+ m n) 2.0) M) 2.0))))
(t_4 (cos (- (/ (* K (+ m n)) 2.0) M))))
(if (<= (* t_4 t_3) 0.0)
(* t_4 (exp (+ (* (pow t_1 2.0) (* t_1 (- M t_0))) t_2)))
(* t_3 (cos M)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double t_1 = cbrt((t_0 - M));
double t_2 = fabs((m - n)) - l;
double t_3 = exp((t_2 - pow((((m + n) / 2.0) - M), 2.0)));
double t_4 = cos((((K * (m + n)) / 2.0) - M));
double tmp;
if ((t_4 * t_3) <= 0.0) {
tmp = t_4 * exp(((pow(t_1, 2.0) * (t_1 * (M - t_0))) + t_2));
} else {
tmp = t_3 * cos(M);
}
return tmp;
}
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double t_1 = Math.cbrt((t_0 - M));
double t_2 = Math.abs((m - n)) - l;
double t_3 = Math.exp((t_2 - Math.pow((((m + n) / 2.0) - M), 2.0)));
double t_4 = Math.cos((((K * (m + n)) / 2.0) - M));
double tmp;
if ((t_4 * t_3) <= 0.0) {
tmp = t_4 * Math.exp(((Math.pow(t_1, 2.0) * (t_1 * (M - t_0))) + t_2));
} else {
tmp = t_3 * Math.cos(M);
}
return tmp;
}
function code(K, m, n, M, l) t_0 = Float64(Float64(m + n) * 0.5) t_1 = cbrt(Float64(t_0 - M)) t_2 = Float64(abs(Float64(m - n)) - l) t_3 = exp(Float64(t_2 - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) t_4 = cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) tmp = 0.0 if (Float64(t_4 * t_3) <= 0.0) tmp = Float64(t_4 * exp(Float64(Float64((t_1 ^ 2.0) * Float64(t_1 * Float64(M - t_0))) + t_2))); else tmp = Float64(t_3 * cos(M)); end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[Power[N[(t$95$0 - M), $MachinePrecision], 1/3], $MachinePrecision]}, Block[{t$95$2 = N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]}, Block[{t$95$3 = N[Exp[N[(t$95$2 - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$4 = N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$4 * t$95$3), $MachinePrecision], 0.0], N[(t$95$4 * N[Exp[N[(N[(N[Power[t$95$1, 2.0], $MachinePrecision] * N[(t$95$1 * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + t$95$2), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$3 * N[Cos[M], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5\\
t_1 := \sqrt[3]{t\_0 - M}\\
t_2 := \left|m - n\right| - \ell\\
t_3 := e^{t\_2 - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
t_4 := \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)\\
\mathbf{if}\;t\_4 \cdot t\_3 \leq 0:\\
\;\;\;\;t\_4 \cdot e^{{t\_1}^{2} \cdot \left(t\_1 \cdot \left(M - t\_0\right)\right) + t\_2}\\
\mathbf{else}:\\
\;\;\;\;t\_3 \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)))))) < 0.0Initial program 98.2%
unpow298.2%
add-cbrt-cube98.2%
unpow298.2%
cbrt-prod98.2%
associate-*l*98.2%
unpow298.2%
cbrt-prod98.2%
pow298.2%
div-inv98.2%
metadata-eval98.2%
Applied egg-rr98.2%
if 0.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 29.8%
Taylor expanded in K around 0 96.5%
cos-neg96.5%
Simplified96.5%
Final simplification97.9%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (fabs (- m n)) l))
(t_1 (exp (- t_0 (pow (- (/ (+ m n) 2.0) M) 2.0))))
(t_2 (cos (- (/ (* K (+ m n)) 2.0) M))))
(if (<= (* t_2 t_1) -2e-64)
(*
t_2
(exp (- t_0 (pow (cbrt (* (- (* m 0.5) M) (+ (* m 0.5) (- n M)))) 3.0))))
(* t_1 (cos M)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n)) - l;
double t_1 = exp((t_0 - pow((((m + n) / 2.0) - M), 2.0)));
double t_2 = cos((((K * (m + n)) / 2.0) - M));
double tmp;
if ((t_2 * t_1) <= -2e-64) {
tmp = t_2 * exp((t_0 - pow(cbrt((((m * 0.5) - M) * ((m * 0.5) + (n - M)))), 3.0)));
} else {
tmp = t_1 * cos(M);
}
return tmp;
}
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.abs((m - n)) - l;
double t_1 = Math.exp((t_0 - Math.pow((((m + n) / 2.0) - M), 2.0)));
double t_2 = Math.cos((((K * (m + n)) / 2.0) - M));
double tmp;
if ((t_2 * t_1) <= -2e-64) {
tmp = t_2 * Math.exp((t_0 - Math.pow(Math.cbrt((((m * 0.5) - M) * ((m * 0.5) + (n - M)))), 3.0)));
} else {
tmp = t_1 * Math.cos(M);
}
return tmp;
}
function code(K, m, n, M, l) t_0 = Float64(abs(Float64(m - n)) - l) t_1 = exp(Float64(t_0 - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) t_2 = cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) tmp = 0.0 if (Float64(t_2 * t_1) <= -2e-64) tmp = Float64(t_2 * exp(Float64(t_0 - (cbrt(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(m * 0.5) + Float64(n - M)))) ^ 3.0)))); else tmp = Float64(t_1 * cos(M)); end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(t$95$0 - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 * t$95$1), $MachinePrecision], -2e-64], N[(t$95$2 * N[Exp[N[(t$95$0 - N[Power[N[Power[N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(m * 0.5), $MachinePrecision] + N[(n - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[M], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
t_1 := e^{t\_0 - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
t_2 := \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)\\
\mathbf{if}\;t\_2 \cdot t\_1 \leq -2 \cdot 10^{-64}:\\
\;\;\;\;t\_2 \cdot e^{t\_0 - {\left(\sqrt[3]{\left(m \cdot 0.5 - M\right) \cdot \left(m \cdot 0.5 + \left(n - M\right)\right)}\right)}^{3}}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \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)))))) < -1.99999999999999993e-64Initial program 60.0%
Taylor expanded in n around 0 57.9%
+-commutative57.9%
unpow257.9%
distribute-rgt-out57.9%
*-commutative57.9%
*-commutative57.9%
Simplified57.9%
add-cube-cbrt57.9%
pow357.9%
associate-+l-57.9%
Applied egg-rr57.9%
if -1.99999999999999993e-64 < (*.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 84.6%
Taylor expanded in K around 0 99.2%
cos-neg99.2%
Simplified99.2%
Final simplification97.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (fabs (- m n)) l))
(t_1 (exp (- t_0 (pow (- (/ (+ m n) 2.0) M) 2.0))))
(t_2 (cos (- (/ (* K (+ m n)) 2.0) M))))
(if (<= (* t_2 t_1) -2e-64)
(* t_2 (exp (fma (- (* m 0.5) M) (- (- M n) (* m 0.5)) t_0)))
(* t_1 (cos M)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n)) - l;
double t_1 = exp((t_0 - pow((((m + n) / 2.0) - M), 2.0)));
double t_2 = cos((((K * (m + n)) / 2.0) - M));
double tmp;
if ((t_2 * t_1) <= -2e-64) {
tmp = t_2 * exp(fma(((m * 0.5) - M), ((M - n) - (m * 0.5)), t_0));
} else {
tmp = t_1 * cos(M);
}
return tmp;
}
function code(K, m, n, M, l) t_0 = Float64(abs(Float64(m - n)) - l) t_1 = exp(Float64(t_0 - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) t_2 = cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) tmp = 0.0 if (Float64(t_2 * t_1) <= -2e-64) tmp = Float64(t_2 * exp(fma(Float64(Float64(m * 0.5) - M), Float64(Float64(M - n) - Float64(m * 0.5)), t_0))); else tmp = Float64(t_1 * cos(M)); end return tmp end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(t$95$0 - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(t$95$2 * t$95$1), $MachinePrecision], -2e-64], N[(t$95$2 * N[Exp[N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - n), $MachinePrecision] - N[(m * 0.5), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$1 * N[Cos[M], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
t_1 := e^{t\_0 - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
t_2 := \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right)\\
\mathbf{if}\;t\_2 \cdot t\_1 \leq -2 \cdot 10^{-64}:\\
\;\;\;\;t\_2 \cdot e^{\mathsf{fma}\left(m \cdot 0.5 - M, \left(M - n\right) - m \cdot 0.5, t\_0\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_1 \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)))))) < -1.99999999999999993e-64Initial program 60.0%
Taylor expanded in n around 0 57.9%
+-commutative57.9%
unpow257.9%
distribute-rgt-out57.9%
*-commutative57.9%
*-commutative57.9%
Simplified57.9%
*-un-lft-identity57.9%
distribute-rgt-neg-in57.9%
fma-neg57.9%
associate-+l-57.9%
Applied egg-rr57.9%
*-lft-identity57.9%
associate--r-57.9%
sub-neg57.9%
*-commutative57.9%
+-commutative57.9%
neg-mul-157.9%
+-commutative57.9%
neg-mul-157.9%
associate-+r+57.9%
sub-neg57.9%
*-commutative57.9%
Simplified57.9%
if -1.99999999999999993e-64 < (*.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 84.6%
Taylor expanded in K around 0 99.2%
cos-neg99.2%
Simplified99.2%
Final simplification97.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0))))
(t_1 (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_0)))
(if (<= t_1 2e-98) t_1 (* 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 t_1 = cos((((K * (m + n)) / 2.0) - M)) * t_0;
double tmp;
if (t_1 <= 2e-98) {
tmp = t_1;
} else {
tmp = t_0 * cos(M);
}
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) :: t_1
real(8) :: tmp
t_0 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
t_1 = cos((((k * (m + n)) / 2.0d0) - m_1)) * t_0
if (t_1 <= 2d-98) then
tmp = t_1
else
tmp = t_0 * cos(m_1)
end if
code = tmp
end function
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 t_1 = Math.cos((((K * (m + n)) / 2.0) - M)) * t_0;
double tmp;
if (t_1 <= 2e-98) {
tmp = t_1;
} 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))) t_1 = math.cos((((K * (m + n)) / 2.0) - M)) * t_0 tmp = 0 if t_1 <= 2e-98: tmp = t_1 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))) t_1 = Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_0) tmp = 0.0 if (t_1 <= 2e-98) tmp = t_1; 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))); t_1 = cos((((K * (m + n)) / 2.0) - M)) * t_0; tmp = 0.0; if (t_1 <= 2e-98) tmp = t_1; 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]}, Block[{t$95$1 = N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$0), $MachinePrecision]}, If[LessEqual[t$95$1, 2e-98], t$95$1, 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}}\\
t_1 := \cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t\_0\\
\mathbf{if}\;t\_1 \leq 2 \cdot 10^{-98}:\\
\;\;\;\;t\_1\\
\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)))))) < 1.99999999999999988e-98Initial program 98.2%
if 1.99999999999999988e-98 < (*.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 28.6%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Final simplification97.9%
(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 83.8%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Final simplification96.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (fabs (- m n)) l)))
(if (<= m -54.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (or (<= m -1.15e-227) (and (not (<= m 1.15e-248)) (<= m 9.5e-170)))
(* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (+ t_0 (* M (- n M)))))
(* (cos M) (exp (- t_0 (* 0.5 (* n (+ m (* n 0.5)))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n)) - l;
double tmp;
if (m <= -54.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if ((m <= -1.15e-227) || (!(m <= 1.15e-248) && (m <= 9.5e-170))) {
tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((t_0 + (M * (n - M))));
} else {
tmp = cos(M) * exp((t_0 - (0.5 * (n * (m + (n * 0.5))))));
}
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 = abs((m - n)) - l
if (m <= (-54.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if ((m <= (-1.15d-227)) .or. (.not. (m <= 1.15d-248)) .and. (m <= 9.5d-170)) then
tmp = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((t_0 + (m_1 * (n - m_1))))
else
tmp = cos(m_1) * exp((t_0 - (0.5d0 * (n * (m + (n * 0.5d0))))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.abs((m - n)) - l;
double tmp;
if (m <= -54.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if ((m <= -1.15e-227) || (!(m <= 1.15e-248) && (m <= 9.5e-170))) {
tmp = Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((t_0 + (M * (n - M))));
} else {
tmp = Math.cos(M) * Math.exp((t_0 - (0.5 * (n * (m + (n * 0.5))))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((m - n)) - l tmp = 0 if m <= -54.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif (m <= -1.15e-227) or (not (m <= 1.15e-248) and (m <= 9.5e-170)): tmp = math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((t_0 + (M * (n - M)))) else: tmp = math.cos(M) * math.exp((t_0 - (0.5 * (n * (m + (n * 0.5)))))) return tmp
function code(K, m, n, M, l) t_0 = Float64(abs(Float64(m - n)) - l) tmp = 0.0 if (m <= -54.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif ((m <= -1.15e-227) || (!(m <= 1.15e-248) && (m <= 9.5e-170))) tmp = Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(t_0 + Float64(M * Float64(n - M))))); else tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(0.5 * Float64(n * Float64(m + Float64(n * 0.5))))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((m - n)) - l; tmp = 0.0; if (m <= -54.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif ((m <= -1.15e-227) || (~((m <= 1.15e-248)) && (m <= 9.5e-170))) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((t_0 + (M * (n - M)))); else tmp = cos(M) * exp((t_0 - (0.5 * (n * (m + (n * 0.5)))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]}, If[LessEqual[m, -54.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, -1.15e-227], And[N[Not[LessEqual[m, 1.15e-248]], $MachinePrecision], LessEqual[m, 9.5e-170]]], N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(0.5 * N[(n * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
\mathbf{if}\;m \leq -54:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -1.15 \cdot 10^{-227} \lor \neg \left(m \leq 1.15 \cdot 10^{-248}\right) \land m \leq 9.5 \cdot 10^{-170}:\\
\;\;\;\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{t\_0 + M \cdot \left(n - M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t\_0 - 0.5 \cdot \left(n \cdot \left(m + n \cdot 0.5\right)\right)}\\
\end{array}
\end{array}
if m < -54Initial program 76.1%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in m around inf 97.1%
if -54 < m < -1.15000000000000006e-227 or 1.15e-248 < m < 9.5000000000000001e-170Initial program 88.0%
Taylor expanded in n around 0 68.8%
+-commutative68.8%
unpow268.8%
distribute-rgt-out73.2%
*-commutative73.2%
*-commutative73.2%
Simplified73.2%
Taylor expanded in m around 0 73.2%
associate--r+73.2%
associate-*r*73.2%
neg-mul-173.2%
cancel-sign-sub73.2%
Simplified73.2%
if -1.15000000000000006e-227 < m < 1.15e-248 or 9.5000000000000001e-170 < m Initial program 85.6%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in m around 0 76.4%
+-commutative76.4%
unpow276.4%
distribute-rgt-out83.8%
*-commutative83.8%
*-commutative83.8%
Simplified83.8%
Taylor expanded in M around 0 63.6%
associate--r+63.6%
fabs-sub63.6%
*-commutative63.6%
Simplified63.6%
Final simplification74.9%
(FPCore (K m n M l)
:precision binary64
(if (<= m -26.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (or (<= m -1.5e-227) (and (not (<= m 5.8e-265)) (<= m 4.3e-159)))
(* (cos M) (exp (- (pow M 2.0))))
(* (cos M) (pow E (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -26.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if ((m <= -1.5e-227) || (!(m <= 5.8e-265) && (m <= 4.3e-159))) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * pow(((double) M_E), (-0.25 * pow(n, 2.0)));
}
return tmp;
}
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -26.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if ((m <= -1.5e-227) || (!(m <= 5.8e-265) && (m <= 4.3e-159))) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.pow(Math.E, (-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -26.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif (m <= -1.5e-227) or (not (m <= 5.8e-265) and (m <= 4.3e-159)): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.pow(math.e, (-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -26.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif ((m <= -1.5e-227) || (!(m <= 5.8e-265) && (m <= 4.3e-159))) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * (exp(1) ^ Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -26.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif ((m <= -1.5e-227) || (~((m <= 5.8e-265)) && (m <= 4.3e-159))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * (2.71828182845904523536 ^ (-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -26.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, -1.5e-227], And[N[Not[LessEqual[m, 5.8e-265]], $MachinePrecision], LessEqual[m, 4.3e-159]]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Power[E, N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -26:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -1.5 \cdot 10^{-227} \lor \neg \left(m \leq 5.8 \cdot 10^{-265}\right) \land m \leq 4.3 \cdot 10^{-159}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot {e}^{\left(-0.25 \cdot {n}^{2}\right)}\\
\end{array}
\end{array}
if m < -26Initial program 76.1%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in m around inf 97.1%
if -26 < m < -1.5e-227 or 5.7999999999999995e-265 < m < 4.3e-159Initial program 86.8%
Taylor expanded in K around 0 90.6%
cos-neg90.6%
Simplified90.6%
Taylor expanded in M around inf 65.3%
mul-1-neg65.3%
Simplified65.3%
if -1.5e-227 < m < 5.7999999999999995e-265 or 4.3e-159 < m Initial program 86.3%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in n around inf 58.0%
*-un-lft-identity58.0%
exp-prod58.0%
Applied egg-rr58.0%
exp-1-e58.0%
*-commutative58.0%
Simplified58.0%
Final simplification70.2%
(FPCore (K m n M l)
:precision binary64
(if (<= m -26.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (or (<= m -1.1e-227) (and (not (<= m 4e-252)) (<= m 1.1e-155)))
(* (cos M) (exp (- (pow M 2.0))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -26.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if ((m <= -1.1e-227) || (!(m <= 4e-252) && (m <= 1.1e-155))) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * 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) :: tmp
if (m <= (-26.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if ((m <= (-1.1d-227)) .or. (.not. (m <= 4d-252)) .and. (m <= 1.1d-155)) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * 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 tmp;
if (m <= -26.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if ((m <= -1.1e-227) || (!(m <= 4e-252) && (m <= 1.1e-155))) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -26.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif (m <= -1.1e-227) or (not (m <= 4e-252) and (m <= 1.1e-155)): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -26.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif ((m <= -1.1e-227) || (!(m <= 4e-252) && (m <= 1.1e-155))) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -26.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif ((m <= -1.1e-227) || (~((m <= 4e-252)) && (m <= 1.1e-155))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -26.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, -1.1e-227], And[N[Not[LessEqual[m, 4e-252]], $MachinePrecision], LessEqual[m, 1.1e-155]]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $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}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -26:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -1.1 \cdot 10^{-227} \lor \neg \left(m \leq 4 \cdot 10^{-252}\right) \land m \leq 1.1 \cdot 10^{-155}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -26Initial program 76.1%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in m around inf 97.1%
if -26 < m < -1.0999999999999999e-227 or 3.99999999999999977e-252 < m < 1.1e-155Initial program 88.0%
Taylor expanded in K around 0 91.6%
cos-neg91.6%
Simplified91.6%
Taylor expanded in M around inf 65.9%
mul-1-neg65.9%
Simplified65.9%
if -1.0999999999999999e-227 < m < 3.99999999999999977e-252 or 1.1e-155 < m Initial program 85.6%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in n around inf 57.7%
Final simplification70.2%
(FPCore (K m n M l)
:precision binary64
(if (<= m -26.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(cos M)
(exp (+ (- (fabs (- m n)) l) (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -26.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp(((fabs((m - n)) - l) + (((n * 0.5) - M) * ((M - (n * 0.5)) - m))));
}
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 <= (-26.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((abs((m - n)) - l) + (((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -26.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) + (((n * 0.5) - M) * ((M - (n * 0.5)) - m))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -26.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp(((math.fabs((m - n)) - l) + (((n * 0.5) - M) * ((M - (n * 0.5)) - m)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -26.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) + Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -26.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp(((abs((m - n)) - l) + (((n * 0.5) - M) * ((M - (n * 0.5)) - m)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -26.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[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] + N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -26:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) + \left(n \cdot 0.5 - M\right) \cdot \left(\left(M - n \cdot 0.5\right) - m\right)}\\
\end{array}
\end{array}
if m < -26Initial program 76.1%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in m around inf 97.1%
if -26 < m Initial program 86.5%
Taylor expanded in K around 0 95.5%
cos-neg95.5%
Simplified95.5%
Taylor expanded in m around 0 81.8%
+-commutative81.8%
unpow281.8%
distribute-rgt-out86.6%
*-commutative86.6%
*-commutative86.6%
Simplified86.6%
Final simplification89.4%
(FPCore (K m n M l)
:precision binary64
(if (<= n -6.4e-180)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 3.8e+23)
(* (cos M) (exp (+ (- (fabs (- m n)) l) (* M (- m M)))))
(* (cos M) (pow E (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -6.4e-180) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 3.8e+23) {
tmp = cos(M) * exp(((fabs((m - n)) - l) + (M * (m - M))));
} else {
tmp = cos(M) * pow(((double) M_E), (-0.25 * pow(n, 2.0)));
}
return tmp;
}
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -6.4e-180) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 3.8e+23) {
tmp = Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) + (M * (m - M))));
} else {
tmp = Math.cos(M) * Math.pow(Math.E, (-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -6.4e-180: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 3.8e+23: tmp = math.cos(M) * math.exp(((math.fabs((m - n)) - l) + (M * (m - M)))) else: tmp = math.cos(M) * math.pow(math.e, (-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -6.4e-180) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 3.8e+23) tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) + Float64(M * Float64(m - M))))); else tmp = Float64(cos(M) * (exp(1) ^ Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -6.4e-180) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (n <= 3.8e+23) tmp = cos(M) * exp(((abs((m - n)) - l) + (M * (m - M)))); else tmp = cos(M) * (2.71828182845904523536 ^ (-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -6.4e-180], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 3.8e+23], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Power[E, N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.4 \cdot 10^{-180}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 3.8 \cdot 10^{+23}:\\
\;\;\;\;\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) + M \cdot \left(m - M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot {e}^{\left(-0.25 \cdot {n}^{2}\right)}\\
\end{array}
\end{array}
if n < -6.4000000000000003e-180Initial program 81.6%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in m around inf 52.5%
if -6.4000000000000003e-180 < n < 3.79999999999999975e23Initial program 86.5%
Taylor expanded in K around 0 93.1%
cos-neg93.1%
Simplified93.1%
Taylor expanded in m around 0 68.1%
+-commutative68.1%
unpow268.1%
distribute-rgt-out75.4%
*-commutative75.4%
*-commutative75.4%
Simplified75.4%
Taylor expanded in n around 0 74.6%
sub-neg74.6%
mul-1-neg74.6%
associate--r+74.6%
mul-1-neg74.6%
sub-neg74.6%
fabs-sub74.6%
associate-*r*74.6%
neg-mul-174.6%
cancel-sign-sub74.6%
Simplified74.6%
if 3.79999999999999975e23 < n Initial program 83.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 100.0%
*-un-lft-identity100.0%
exp-prod100.0%
Applied egg-rr100.0%
exp-1-e100.0%
*-commutative100.0%
Simplified100.0%
Final simplification71.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= M -4e-15)
t_0
(if (<= M -3e-215)
(* (cos M) (exp (- l)))
(if (<= M 1.25e-14) (* (cos M) (exp (* m (- M (* n 0.5))))) t_0)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (M <= -4e-15) {
tmp = t_0;
} else if (M <= -3e-215) {
tmp = cos(M) * exp(-l);
} else if (M <= 1.25e-14) {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
} else {
tmp = t_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 = cos(m_1) * exp(-(m_1 ** 2.0d0))
if (m_1 <= (-4d-15)) then
tmp = t_0
else if (m_1 <= (-3d-215)) then
tmp = cos(m_1) * exp(-l)
else if (m_1 <= 1.25d-14) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
else
tmp = t_0
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(-Math.pow(M, 2.0));
double tmp;
if (M <= -4e-15) {
tmp = t_0;
} else if (M <= -3e-215) {
tmp = Math.cos(M) * Math.exp(-l);
} else if (M <= 1.25e-14) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if M <= -4e-15: tmp = t_0 elif M <= -3e-215: tmp = math.cos(M) * math.exp(-l) elif M <= 1.25e-14: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (M <= -4e-15) tmp = t_0; elseif (M <= -3e-215) tmp = Float64(cos(M) * exp(Float64(-l))); elseif (M <= 1.25e-14) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (M <= -4e-15) tmp = t_0; elseif (M <= -3e-215) tmp = cos(M) * exp(-l); elseif (M <= 1.25e-14) tmp = cos(M) * exp((m * (M - (n * 0.5)))); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -4e-15], t$95$0, If[LessEqual[M, -3e-215], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.25e-14], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;M \leq -4 \cdot 10^{-15}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq -3 \cdot 10^{-215}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{elif}\;M \leq 1.25 \cdot 10^{-14}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -4.0000000000000003e-15 or 1.25e-14 < M Initial program 89.5%
Taylor expanded in K around 0 99.3%
cos-neg99.3%
Simplified99.3%
Taylor expanded in M around inf 95.2%
mul-1-neg95.2%
Simplified95.2%
if -4.0000000000000003e-15 < M < -3.00000000000000025e-215Initial program 80.3%
Taylor expanded in K around 0 93.3%
cos-neg93.3%
Simplified93.3%
Taylor expanded in l around inf 31.2%
neg-mul-131.2%
Simplified31.2%
if -3.00000000000000025e-215 < M < 1.25e-14Initial program 74.5%
Taylor expanded in K around 0 92.0%
cos-neg92.0%
Simplified92.0%
Taylor expanded in m around 0 69.3%
+-commutative69.3%
unpow269.3%
distribute-rgt-out70.7%
*-commutative70.7%
*-commutative70.7%
Simplified70.7%
Taylor expanded in m around inf 41.7%
*-commutative41.7%
Simplified41.7%
(FPCore (K m n M l)
:precision binary64
(if (<= m -26.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= m 5.5e-103)
(* (cos M) (exp (- (pow M 2.0))))
(* (cos M) (exp (* m (- M (* n 0.5))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -26.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (m <= 5.5e-103) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
}
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 <= (-26.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= 5.5d-103) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -26.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= 5.5e-103) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -26.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif m <= 5.5e-103: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -26.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (m <= 5.5e-103) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -26.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (m <= 5.5e-103) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((m * (M - (n * 0.5)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -26.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 5.5e-103], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -26:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq 5.5 \cdot 10^{-103}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < -26Initial program 76.1%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in m around inf 97.1%
if -26 < m < 5.50000000000000032e-103Initial program 86.1%
Taylor expanded in K around 0 93.3%
cos-neg93.3%
Simplified93.3%
Taylor expanded in M around inf 61.0%
mul-1-neg61.0%
Simplified61.0%
if 5.50000000000000032e-103 < m Initial program 87.0%
Taylor expanded in K around 0 98.6%
cos-neg98.6%
Simplified98.6%
Taylor expanded in m around 0 65.5%
+-commutative65.5%
unpow265.5%
distribute-rgt-out77.1%
*-commutative77.1%
*-commutative77.1%
Simplified77.1%
Taylor expanded in m around inf 43.2%
*-commutative43.2%
Simplified43.2%
(FPCore (K m n M l) :precision binary64 (if (<= l 3.8e-32) (* (cos M) (exp (* m (- M (* n 0.5))))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 3.8e-32) {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
} 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 (l <= 3.8d-32) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
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 (l <= 3.8e-32) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 3.8e-32: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 3.8e-32) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); 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 (l <= 3.8e-32) tmp = cos(M) * exp((m * (M - (n * 0.5)))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 3.8e-32], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 3.8 \cdot 10^{-32}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < 3.80000000000000008e-32Initial program 82.6%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Taylor expanded in m around 0 78.3%
+-commutative78.3%
unpow278.3%
distribute-rgt-out83.3%
*-commutative83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in m around inf 37.8%
*-commutative37.8%
Simplified37.8%
if 3.80000000000000008e-32 < l Initial program 87.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 91.5%
neg-mul-191.5%
Simplified91.5%
(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 83.8%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Taylor expanded in l around inf 29.0%
neg-mul-129.0%
Simplified29.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 83.8%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Taylor expanded in l around inf 29.0%
neg-mul-129.0%
Simplified29.0%
Taylor expanded in M around 0 28.6%
(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 83.8%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Taylor expanded in l around inf 29.0%
neg-mul-129.0%
Simplified29.0%
Taylor expanded in l around 0 5.5%
herbie shell --seed 2024103
(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)))))))