
(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 14 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 (* (pow (cbrt (cos (- (expm1 (* -0.125 (pow (* K (+ m n)) 2.0))) M))) 3.0) (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return pow(cbrt(cos((expm1((-0.125 * pow((K * (m + n)), 2.0))) - M))), 3.0) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
}
public static double code(double K, double m, double n, double M, double l) {
return Math.pow(Math.cbrt(Math.cos((Math.expm1((-0.125 * Math.pow((K * (m + n)), 2.0))) - M))), 3.0) * Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
function code(K, m, n, M, l) return Float64((cbrt(cos(Float64(expm1(Float64(-0.125 * (Float64(K * Float64(m + n)) ^ 2.0))) - M))) ^ 3.0) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
code[K_, m_, n_, M_, l_] := N[(N[Power[N[Power[N[Cos[N[(N[(Exp[N[(-0.125 * N[Power[N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
{\left(\sqrt[3]{\cos \left(\mathsf{expm1}\left(-0.125 \cdot {\left(K \cdot \left(m + n\right)\right)}^{2}\right) - M\right)}\right)}^{3} \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 73.9%
associate-/l*74.0%
+-commutative74.0%
fabs-sub74.0%
+-commutative74.0%
Simplified74.0%
expm1-log1p-u48.4%
div-inv48.4%
clear-num48.4%
div-inv48.4%
metadata-eval48.4%
Applied egg-rr48.4%
Taylor expanded in K around 0 76.4%
fma-def76.4%
*-commutative76.4%
unpow276.4%
unpow276.4%
swap-sqr85.8%
unpow285.8%
+-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in K around inf 86.9%
unpow286.9%
unpow286.9%
swap-sqr96.4%
unpow296.4%
*-commutative96.4%
+-commutative96.4%
+-commutative96.4%
*-commutative96.4%
Simplified96.4%
add-cube-cbrt96.4%
pow396.4%
Applied egg-rr96.4%
Final simplification96.4%
(FPCore (K m n M l) :precision binary64 (* (cos (- (expm1 (* -0.125 (pow (* K (+ m n)) 2.0))) M)) (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos((expm1((-0.125 * pow((K * (m + n)), 2.0))) - M)) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
}
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((Math.expm1((-0.125 * Math.pow((K * (m + n)), 2.0))) - M)) * Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos((math.expm1((-0.125 * math.pow((K * (m + n)), 2.0))) - M)) * math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(expm1(Float64(-0.125 * (Float64(K * Float64(m + n)) ^ 2.0))) - M)) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(Exp[N[(-0.125 * N[Power[N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\mathsf{expm1}\left(-0.125 \cdot {\left(K \cdot \left(m + n\right)\right)}^{2}\right) - M\right) \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 73.9%
associate-/l*74.0%
+-commutative74.0%
fabs-sub74.0%
+-commutative74.0%
Simplified74.0%
expm1-log1p-u48.4%
div-inv48.4%
clear-num48.4%
div-inv48.4%
metadata-eval48.4%
Applied egg-rr48.4%
Taylor expanded in K around 0 76.4%
fma-def76.4%
*-commutative76.4%
unpow276.4%
unpow276.4%
swap-sqr85.8%
unpow285.8%
+-commutative85.8%
associate-*r*85.8%
*-commutative85.8%
+-commutative85.8%
Simplified85.8%
Taylor expanded in K around inf 86.9%
unpow286.9%
unpow286.9%
swap-sqr96.4%
unpow296.4%
*-commutative96.4%
+-commutative96.4%
+-commutative96.4%
*-commutative96.4%
Simplified96.4%
Final simplification96.4%
(FPCore (K m n M l) :precision binary64 (* (cos (- M)) (exp (- (fabs (- m n)) (+ l (pow (- (* (+ m n) 0.5) M) 2.0))))))
double code(double K, double m, double n, double M, double l) {
return cos(-M) * exp((fabs((m - n)) - (l + pow((((m + n) * 0.5) - M), 2.0))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(-m_1) * exp((abs((m - n)) - (l + ((((m + n) * 0.5d0) - m_1) ** 2.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(-M) * Math.exp((Math.abs((m - n)) - (l + Math.pow((((m + n) * 0.5) - M), 2.0))));
}
def code(K, m, n, M, l): return math.cos(-M) * math.exp((math.fabs((m - n)) - (l + math.pow((((m + n) * 0.5) - M), 2.0))))
function code(K, m, n, M, l) return Float64(cos(Float64(-M)) * exp(Float64(abs(Float64(m - n)) - Float64(l + (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0))))) end
function tmp = code(K, m, n, M, l) tmp = cos(-M) * exp((abs((m - n)) - (l + ((((m + n) * 0.5) - M) ^ 2.0)))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(-M\right) \cdot e^{\left|m - n\right| - \left(\ell + {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}
\end{array}
Initial program 73.9%
Taylor expanded in K around 0 96.0%
Final simplification96.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- M))))
(if (<= m 6.5e-125)
(*
t_0
(exp (+ (fabs (- m n)) (- (* (- (* m 0.5) M) (- (- M (* m 0.5)) n)) l))))
(* t_0 (exp (* n (* m -0.5)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(-M);
double tmp;
if (m <= 6.5e-125) {
tmp = t_0 * exp((fabs((m - n)) + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l)));
} else {
tmp = t_0 * exp((n * (m * -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 = cos(-m_1)
if (m <= 6.5d-125) then
tmp = t_0 * exp((abs((m - n)) + ((((m * 0.5d0) - m_1) * ((m_1 - (m * 0.5d0)) - n)) - l)))
else
tmp = t_0 * exp((n * (m * (-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.cos(-M);
double tmp;
if (m <= 6.5e-125) {
tmp = t_0 * Math.exp((Math.abs((m - n)) + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l)));
} else {
tmp = t_0 * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(-M) tmp = 0 if m <= 6.5e-125: tmp = t_0 * math.exp((math.fabs((m - n)) + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l))) else: tmp = t_0 * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(-M)) tmp = 0.0 if (m <= 6.5e-125) tmp = Float64(t_0 * exp(Float64(abs(Float64(m - n)) + Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - Float64(m * 0.5)) - n)) - l)))); else tmp = Float64(t_0 * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(-M); tmp = 0.0; if (m <= 6.5e-125) tmp = t_0 * exp((abs((m - n)) + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l))); else tmp = t_0 * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[(-M)], $MachinePrecision]}, If[LessEqual[m, 6.5e-125], N[(t$95$0 * N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-M\right)\\
\mathbf{if}\;m \leq 6.5 \cdot 10^{-125}:\\
\;\;\;\;t_0 \cdot e^{\left|m - n\right| + \left(\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - m \cdot 0.5\right) - n\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < 6.4999999999999999e-125Initial program 76.8%
Taylor expanded in K around 0 97.1%
Taylor expanded in n around 0 73.3%
+-commutative73.3%
unpow273.3%
distribute-rgt-out75.8%
Simplified75.8%
if 6.4999999999999999e-125 < m Initial program 69.0%
Taylor expanded in K around 0 94.0%
Taylor expanded in n around 0 73.8%
+-commutative73.8%
unpow273.8%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in n around inf 46.4%
Taylor expanded in m around inf 44.6%
associate-*r*44.6%
Simplified44.6%
Final simplification64.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- M))) (t_1 (fabs (- m n))) (t_2 (- (* n 0.5) M)))
(if (<= n 100000000000.0)
(* t_0 (exp (+ t_1 (- (* (- (* m 0.5) M) (- (- M (* m 0.5)) n)) l))))
(* t_0 (exp (- t_1 (+ l (* t_2 (+ m t_2)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(-M);
double t_1 = fabs((m - n));
double t_2 = (n * 0.5) - M;
double tmp;
if (n <= 100000000000.0) {
tmp = t_0 * exp((t_1 + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l)));
} else {
tmp = t_0 * exp((t_1 - (l + (t_2 * (m + t_2)))));
}
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) :: t_2
real(8) :: tmp
t_0 = cos(-m_1)
t_1 = abs((m - n))
t_2 = (n * 0.5d0) - m_1
if (n <= 100000000000.0d0) then
tmp = t_0 * exp((t_1 + ((((m * 0.5d0) - m_1) * ((m_1 - (m * 0.5d0)) - n)) - l)))
else
tmp = t_0 * exp((t_1 - (l + (t_2 * (m + t_2)))))
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);
double t_1 = Math.abs((m - n));
double t_2 = (n * 0.5) - M;
double tmp;
if (n <= 100000000000.0) {
tmp = t_0 * Math.exp((t_1 + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l)));
} else {
tmp = t_0 * Math.exp((t_1 - (l + (t_2 * (m + t_2)))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(-M) t_1 = math.fabs((m - n)) t_2 = (n * 0.5) - M tmp = 0 if n <= 100000000000.0: tmp = t_0 * math.exp((t_1 + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l))) else: tmp = t_0 * math.exp((t_1 - (l + (t_2 * (m + t_2))))) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(-M)) t_1 = abs(Float64(m - n)) t_2 = Float64(Float64(n * 0.5) - M) tmp = 0.0 if (n <= 100000000000.0) tmp = Float64(t_0 * exp(Float64(t_1 + Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - Float64(m * 0.5)) - n)) - l)))); else tmp = Float64(t_0 * exp(Float64(t_1 - Float64(l + Float64(t_2 * Float64(m + t_2)))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(-M); t_1 = abs((m - n)); t_2 = (n * 0.5) - M; tmp = 0.0; if (n <= 100000000000.0) tmp = t_0 * exp((t_1 + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l))); else tmp = t_0 * exp((t_1 - (l + (t_2 * (m + t_2))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[(-M)], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$2 = N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision]}, If[LessEqual[n, 100000000000.0], N[(t$95$0 * N[Exp[N[(t$95$1 + N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Exp[N[(t$95$1 - N[(l + N[(t$95$2 * N[(m + t$95$2), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-M\right)\\
t_1 := \left|m - n\right|\\
t_2 := n \cdot 0.5 - M\\
\mathbf{if}\;n \leq 100000000000:\\
\;\;\;\;t_0 \cdot e^{t_1 + \left(\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - m \cdot 0.5\right) - n\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot e^{t_1 - \left(\ell + t_2 \cdot \left(m + t_2\right)\right)}\\
\end{array}
\end{array}
if n < 1e11Initial program 76.9%
Taylor expanded in K around 0 95.0%
Taylor expanded in n around 0 79.9%
+-commutative79.9%
unpow279.9%
distribute-rgt-out82.1%
Simplified82.1%
if 1e11 < n Initial program 66.2%
Taylor expanded in K around 0 98.6%
Taylor expanded in m around 0 84.5%
+-commutative84.5%
unpow284.5%
distribute-rgt-out94.4%
Simplified94.4%
Final simplification85.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- M))) (t_1 (fabs (- m n))))
(if (<= m -3.3e+115)
(* t_0 (exp (- t_1 (+ l (* (* m 0.5) (+ n (* m 0.5)))))))
(if (<= m -950000.0)
(* (cos (- (* K (* m 0.5)) M)) (exp (* (pow m 2.0) -0.25)))
(if (<= m 6.5e-125)
(* t_0 (exp (+ t_1 (- (* M (- n M)) l))))
(* t_0 (exp (* n (* m -0.5)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(-M);
double t_1 = fabs((m - n));
double tmp;
if (m <= -3.3e+115) {
tmp = t_0 * exp((t_1 - (l + ((m * 0.5) * (n + (m * 0.5))))));
} else if (m <= -950000.0) {
tmp = cos(((K * (m * 0.5)) - M)) * exp((pow(m, 2.0) * -0.25));
} else if (m <= 6.5e-125) {
tmp = t_0 * exp((t_1 + ((M * (n - M)) - l)));
} else {
tmp = t_0 * exp((n * (m * -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) :: t_1
real(8) :: tmp
t_0 = cos(-m_1)
t_1 = abs((m - n))
if (m <= (-3.3d+115)) then
tmp = t_0 * exp((t_1 - (l + ((m * 0.5d0) * (n + (m * 0.5d0))))))
else if (m <= (-950000.0d0)) then
tmp = cos(((k * (m * 0.5d0)) - m_1)) * exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= 6.5d-125) then
tmp = t_0 * exp((t_1 + ((m_1 * (n - m_1)) - l)))
else
tmp = t_0 * exp((n * (m * (-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.cos(-M);
double t_1 = Math.abs((m - n));
double tmp;
if (m <= -3.3e+115) {
tmp = t_0 * Math.exp((t_1 - (l + ((m * 0.5) * (n + (m * 0.5))))));
} else if (m <= -950000.0) {
tmp = Math.cos(((K * (m * 0.5)) - M)) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= 6.5e-125) {
tmp = t_0 * Math.exp((t_1 + ((M * (n - M)) - l)));
} else {
tmp = t_0 * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(-M) t_1 = math.fabs((m - n)) tmp = 0 if m <= -3.3e+115: tmp = t_0 * math.exp((t_1 - (l + ((m * 0.5) * (n + (m * 0.5)))))) elif m <= -950000.0: tmp = math.cos(((K * (m * 0.5)) - M)) * math.exp((math.pow(m, 2.0) * -0.25)) elif m <= 6.5e-125: tmp = t_0 * math.exp((t_1 + ((M * (n - M)) - l))) else: tmp = t_0 * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(-M)) t_1 = abs(Float64(m - n)) tmp = 0.0 if (m <= -3.3e+115) tmp = Float64(t_0 * exp(Float64(t_1 - Float64(l + Float64(Float64(m * 0.5) * Float64(n + Float64(m * 0.5))))))); elseif (m <= -950000.0) tmp = Float64(cos(Float64(Float64(K * Float64(m * 0.5)) - M)) * exp(Float64((m ^ 2.0) * -0.25))); elseif (m <= 6.5e-125) tmp = Float64(t_0 * exp(Float64(t_1 + Float64(Float64(M * Float64(n - M)) - l)))); else tmp = Float64(t_0 * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(-M); t_1 = abs((m - n)); tmp = 0.0; if (m <= -3.3e+115) tmp = t_0 * exp((t_1 - (l + ((m * 0.5) * (n + (m * 0.5)))))); elseif (m <= -950000.0) tmp = cos(((K * (m * 0.5)) - M)) * exp(((m ^ 2.0) * -0.25)); elseif (m <= 6.5e-125) tmp = t_0 * exp((t_1 + ((M * (n - M)) - l))); else tmp = t_0 * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[(-M)], $MachinePrecision]}, Block[{t$95$1 = N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -3.3e+115], N[(t$95$0 * N[Exp[N[(t$95$1 - N[(l + N[(N[(m * 0.5), $MachinePrecision] * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -950000.0], N[(N[Cos[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 6.5e-125], N[(t$95$0 * N[Exp[N[(t$95$1 + N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-M\right)\\
t_1 := \left|m - n\right|\\
\mathbf{if}\;m \leq -3.3 \cdot 10^{+115}:\\
\;\;\;\;t_0 \cdot e^{t_1 - \left(\ell + \left(m \cdot 0.5\right) \cdot \left(n + m \cdot 0.5\right)\right)}\\
\mathbf{elif}\;m \leq -950000:\\
\;\;\;\;\cos \left(K \cdot \left(m \cdot 0.5\right) - M\right) \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq 6.5 \cdot 10^{-125}:\\
\;\;\;\;t_0 \cdot e^{t_1 + \left(M \cdot \left(n - M\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -3.30000000000000005e115Initial program 58.8%
Taylor expanded in K around 0 100.0%
Taylor expanded in n around 0 76.6%
+-commutative76.6%
unpow276.6%
distribute-rgt-out85.5%
Simplified85.5%
Taylor expanded in M around 0 85.5%
+-commutative85.5%
associate-*r*85.5%
*-commutative85.5%
*-commutative85.5%
Simplified85.5%
if -3.30000000000000005e115 < m < -9.5e5Initial program 91.7%
associate-/l*91.7%
+-commutative91.7%
fabs-sub91.7%
+-commutative91.7%
Simplified91.7%
Taylor expanded in n around 0 79.4%
+-commutative79.4%
unpow279.4%
distribute-rgt-out79.4%
*-commutative79.4%
*-commutative79.4%
Simplified79.4%
Taylor expanded in n around 0 83.5%
associate-*r*83.5%
*-commutative83.5%
associate-*l*83.5%
*-commutative83.5%
Simplified83.5%
Taylor expanded in m around inf 95.9%
*-commutative95.9%
Simplified95.9%
if -9.5e5 < m < 6.4999999999999999e-125Initial program 79.2%
Taylor expanded in K around 0 96.4%
Taylor expanded in n around 0 69.9%
+-commutative69.9%
unpow269.9%
distribute-rgt-out70.9%
Simplified70.9%
Taylor expanded in m around 0 70.9%
mul-1-neg70.9%
unsub-neg70.9%
Simplified70.9%
if 6.4999999999999999e-125 < m Initial program 69.0%
Taylor expanded in K around 0 94.0%
Taylor expanded in n around 0 73.8%
+-commutative73.8%
unpow273.8%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in n around inf 46.4%
Taylor expanded in m around inf 44.6%
associate-*r*44.6%
Simplified44.6%
Final simplification65.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- M))))
(if (<= m -950000.0)
(* (cos (- (* K (* m 0.5)) M)) (exp (* (pow m 2.0) -0.25)))
(if (<= m 6.5e-125)
(* t_0 (exp (+ (fabs (- m n)) (- (* M (- n M)) l))))
(* t_0 (exp (* n (* m -0.5))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(-M);
double tmp;
if (m <= -950000.0) {
tmp = cos(((K * (m * 0.5)) - M)) * exp((pow(m, 2.0) * -0.25));
} else if (m <= 6.5e-125) {
tmp = t_0 * exp((fabs((m - n)) + ((M * (n - M)) - l)));
} else {
tmp = t_0 * exp((n * (m * -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 = cos(-m_1)
if (m <= (-950000.0d0)) then
tmp = cos(((k * (m * 0.5d0)) - m_1)) * exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= 6.5d-125) then
tmp = t_0 * exp((abs((m - n)) + ((m_1 * (n - m_1)) - l)))
else
tmp = t_0 * exp((n * (m * (-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.cos(-M);
double tmp;
if (m <= -950000.0) {
tmp = Math.cos(((K * (m * 0.5)) - M)) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= 6.5e-125) {
tmp = t_0 * Math.exp((Math.abs((m - n)) + ((M * (n - M)) - l)));
} else {
tmp = t_0 * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(-M) tmp = 0 if m <= -950000.0: tmp = math.cos(((K * (m * 0.5)) - M)) * math.exp((math.pow(m, 2.0) * -0.25)) elif m <= 6.5e-125: tmp = t_0 * math.exp((math.fabs((m - n)) + ((M * (n - M)) - l))) else: tmp = t_0 * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(-M)) tmp = 0.0 if (m <= -950000.0) tmp = Float64(cos(Float64(Float64(K * Float64(m * 0.5)) - M)) * exp(Float64((m ^ 2.0) * -0.25))); elseif (m <= 6.5e-125) tmp = Float64(t_0 * exp(Float64(abs(Float64(m - n)) + Float64(Float64(M * Float64(n - M)) - l)))); else tmp = Float64(t_0 * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(-M); tmp = 0.0; if (m <= -950000.0) tmp = cos(((K * (m * 0.5)) - M)) * exp(((m ^ 2.0) * -0.25)); elseif (m <= 6.5e-125) tmp = t_0 * exp((abs((m - n)) + ((M * (n - M)) - l))); else tmp = t_0 * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[(-M)], $MachinePrecision]}, If[LessEqual[m, -950000.0], N[(N[Cos[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 6.5e-125], N[(t$95$0 * N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] + N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-M\right)\\
\mathbf{if}\;m \leq -950000:\\
\;\;\;\;\cos \left(K \cdot \left(m \cdot 0.5\right) - M\right) \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq 6.5 \cdot 10^{-125}:\\
\;\;\;\;t_0 \cdot e^{\left|m - n\right| + \left(M \cdot \left(n - M\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;t_0 \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -9.5e5Initial program 72.4%
associate-/l*72.4%
+-commutative72.4%
fabs-sub72.4%
+-commutative72.4%
Simplified72.4%
Taylor expanded in n around 0 60.5%
+-commutative60.5%
unpow260.5%
distribute-rgt-out62.2%
*-commutative62.2%
*-commutative62.2%
Simplified62.2%
Taylor expanded in n around 0 64.0%
associate-*r*64.0%
*-commutative64.0%
associate-*l*64.0%
*-commutative64.0%
Simplified64.0%
Taylor expanded in m around inf 74.2%
*-commutative74.2%
Simplified74.2%
if -9.5e5 < m < 6.4999999999999999e-125Initial program 79.2%
Taylor expanded in K around 0 96.4%
Taylor expanded in n around 0 69.9%
+-commutative69.9%
unpow269.9%
distribute-rgt-out70.9%
Simplified70.9%
Taylor expanded in m around 0 70.9%
mul-1-neg70.9%
unsub-neg70.9%
Simplified70.9%
if 6.4999999999999999e-125 < m Initial program 69.0%
Taylor expanded in K around 0 94.0%
Taylor expanded in n around 0 73.8%
+-commutative73.8%
unpow273.8%
distribute-rgt-out78.2%
Simplified78.2%
Taylor expanded in n around inf 46.4%
Taylor expanded in m around inf 44.6%
associate-*r*44.6%
Simplified44.6%
Final simplification62.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- (* K (* m 0.5)) M))))
(if (<= m -15.0)
(* t_0 (exp (* (pow m 2.0) -0.25)))
(if (<= m 4e-94)
(* t_0 (exp (- (pow M 2.0))))
(* (cos (- M)) (exp (* n (* m -0.5))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(((K * (m * 0.5)) - M));
double tmp;
if (m <= -15.0) {
tmp = t_0 * exp((pow(m, 2.0) * -0.25));
} else if (m <= 4e-94) {
tmp = t_0 * exp(-pow(M, 2.0));
} else {
tmp = cos(-M) * exp((n * (m * -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 = cos(((k * (m * 0.5d0)) - m_1))
if (m <= (-15.0d0)) then
tmp = t_0 * exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= 4d-94) then
tmp = t_0 * exp(-(m_1 ** 2.0d0))
else
tmp = cos(-m_1) * exp((n * (m * (-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.cos(((K * (m * 0.5)) - M));
double tmp;
if (m <= -15.0) {
tmp = t_0 * Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= 4e-94) {
tmp = t_0 * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(-M) * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(((K * (m * 0.5)) - M)) tmp = 0 if m <= -15.0: tmp = t_0 * math.exp((math.pow(m, 2.0) * -0.25)) elif m <= 4e-94: tmp = t_0 * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(-M) * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(Float64(K * Float64(m * 0.5)) - M)) tmp = 0.0 if (m <= -15.0) tmp = Float64(t_0 * exp(Float64((m ^ 2.0) * -0.25))); elseif (m <= 4e-94) tmp = Float64(t_0 * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(Float64(-M)) * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(((K * (m * 0.5)) - M)); tmp = 0.0; if (m <= -15.0) tmp = t_0 * exp(((m ^ 2.0) * -0.25)); elseif (m <= 4e-94) tmp = t_0 * exp(-(M ^ 2.0)); else tmp = cos(-M) * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -15.0], N[(t$95$0 * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 4e-94], N[(t$95$0 * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot \left(m \cdot 0.5\right) - M\right)\\
\mathbf{if}\;m \leq -15:\\
\;\;\;\;t_0 \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq 4 \cdot 10^{-94}:\\
\;\;\;\;t_0 \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(-M\right) \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if m < -15Initial program 71.2%
associate-/l*71.2%
+-commutative71.2%
fabs-sub71.2%
+-commutative71.2%
Simplified71.2%
Taylor expanded in n around 0 59.4%
+-commutative59.4%
unpow259.4%
distribute-rgt-out61.2%
*-commutative61.2%
*-commutative61.2%
Simplified61.2%
Taylor expanded in n around 0 62.9%
associate-*r*62.9%
*-commutative62.9%
associate-*l*62.9%
*-commutative62.9%
Simplified62.9%
Taylor expanded in m around inf 72.9%
*-commutative72.9%
Simplified72.9%
if -15 < m < 3.9999999999999998e-94Initial program 78.3%
associate-/l*78.1%
+-commutative78.1%
fabs-sub78.1%
+-commutative78.1%
Simplified78.1%
Taylor expanded in n around 0 60.6%
+-commutative60.6%
unpow260.6%
distribute-rgt-out61.5%
*-commutative61.5%
*-commutative61.5%
Simplified61.5%
Taylor expanded in n around 0 69.9%
associate-*r*69.9%
*-commutative69.9%
associate-*l*69.9%
*-commutative69.9%
Simplified69.9%
Taylor expanded in M around inf 62.4%
mul-1-neg62.4%
Simplified62.4%
if 3.9999999999999998e-94 < m Initial program 69.9%
Taylor expanded in K around 0 94.3%
Taylor expanded in n around 0 75.2%
+-commutative75.2%
unpow275.2%
distribute-rgt-out80.1%
Simplified80.1%
Taylor expanded in n around inf 44.5%
Taylor expanded in m around inf 44.8%
associate-*r*44.8%
Simplified44.8%
Final simplification59.1%
(FPCore (K m n M l) :precision binary64 (if (<= l 700.0) (* (cos (- (* K (* m 0.5)) M)) (exp (- (pow M 2.0)))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 700.0) {
tmp = cos(((K * (m * 0.5)) - M)) * exp(-pow(M, 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 (l <= 700.0d0) then
tmp = cos(((k * (m * 0.5d0)) - m_1)) * exp(-(m_1 ** 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 (l <= 700.0) {
tmp = Math.cos(((K * (m * 0.5)) - M)) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 700.0: tmp = math.cos(((K * (m * 0.5)) - M)) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 700.0) tmp = Float64(cos(Float64(Float64(K * Float64(m * 0.5)) - M)) * exp(Float64(-(M ^ 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 (l <= 700.0) tmp = cos(((K * (m * 0.5)) - M)) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 700.0], N[(N[Cos[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 700:\\
\;\;\;\;\cos \left(K \cdot \left(m \cdot 0.5\right) - M\right) \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < 700Initial program 71.4%
associate-/l*71.4%
+-commutative71.4%
fabs-sub71.4%
+-commutative71.4%
Simplified71.4%
Taylor expanded in n around 0 56.3%
+-commutative56.3%
unpow256.3%
distribute-rgt-out58.8%
*-commutative58.8%
*-commutative58.8%
Simplified58.8%
Taylor expanded in n around 0 63.5%
associate-*r*63.5%
*-commutative63.5%
associate-*l*63.5%
*-commutative63.5%
Simplified63.5%
Taylor expanded in M around inf 53.3%
mul-1-neg53.3%
Simplified53.3%
if 700 < l Initial program 84.3%
associate-/l*84.3%
+-commutative84.3%
fabs-sub84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in n around 0 72.7%
+-commutative72.7%
unpow272.7%
distribute-rgt-out72.7%
*-commutative72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in n around 0 76.7%
associate-*r*76.7%
*-commutative76.7%
associate-*l*76.7%
*-commutative76.7%
Simplified76.7%
Taylor expanded in l around inf 88.2%
mul-1-neg88.2%
Simplified88.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Final simplification62.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0
(*
(cos (- (* K (* m 0.5)) M))
(exp (* M (- (- (+ n (* m 0.5)) (* m -0.5)) M))))))
(if (<= l -3.5e-178)
t_0
(if (<= l -2.7e-240)
(* (cos (- M)) (exp (* n (* m -0.5))))
(if (<= l 700.0) t_0 (* (cos M) (exp (- l))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(((K * (m * 0.5)) - M)) * exp((M * (((n + (m * 0.5)) - (m * -0.5)) - M)));
double tmp;
if (l <= -3.5e-178) {
tmp = t_0;
} else if (l <= -2.7e-240) {
tmp = cos(-M) * exp((n * (m * -0.5)));
} else if (l <= 700.0) {
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(((k * (m * 0.5d0)) - m_1)) * exp((m_1 * (((n + (m * 0.5d0)) - (m * (-0.5d0))) - m_1)))
if (l <= (-3.5d-178)) then
tmp = t_0
else if (l <= (-2.7d-240)) then
tmp = cos(-m_1) * exp((n * (m * (-0.5d0))))
else if (l <= 700.0d0) 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(((K * (m * 0.5)) - M)) * Math.exp((M * (((n + (m * 0.5)) - (m * -0.5)) - M)));
double tmp;
if (l <= -3.5e-178) {
tmp = t_0;
} else if (l <= -2.7e-240) {
tmp = Math.cos(-M) * Math.exp((n * (m * -0.5)));
} else if (l <= 700.0) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(((K * (m * 0.5)) - M)) * math.exp((M * (((n + (m * 0.5)) - (m * -0.5)) - M))) tmp = 0 if l <= -3.5e-178: tmp = t_0 elif l <= -2.7e-240: tmp = math.cos(-M) * math.exp((n * (m * -0.5))) elif l <= 700.0: tmp = t_0 else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(Float64(Float64(K * Float64(m * 0.5)) - M)) * exp(Float64(M * Float64(Float64(Float64(n + Float64(m * 0.5)) - Float64(m * -0.5)) - M)))) tmp = 0.0 if (l <= -3.5e-178) tmp = t_0; elseif (l <= -2.7e-240) tmp = Float64(cos(Float64(-M)) * exp(Float64(n * Float64(m * -0.5)))); elseif (l <= 700.0) 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(((K * (m * 0.5)) - M)) * exp((M * (((n + (m * 0.5)) - (m * -0.5)) - M))); tmp = 0.0; if (l <= -3.5e-178) tmp = t_0; elseif (l <= -2.7e-240) tmp = cos(-M) * exp((n * (m * -0.5))); elseif (l <= 700.0) 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[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(M * N[(N[(N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - N[(m * -0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -3.5e-178], t$95$0, If[LessEqual[l, -2.7e-240], N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 700.0], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot \left(m \cdot 0.5\right) - M\right) \cdot e^{M \cdot \left(\left(\left(n + m \cdot 0.5\right) - m \cdot -0.5\right) - M\right)}\\
\mathbf{if}\;\ell \leq -3.5 \cdot 10^{-178}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq -2.7 \cdot 10^{-240}:\\
\;\;\;\;\cos \left(-M\right) \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\mathbf{elif}\;\ell \leq 700:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -3.49999999999999983e-178 or -2.70000000000000018e-240 < l < 700Initial program 73.1%
associate-/l*73.1%
+-commutative73.1%
fabs-sub73.1%
+-commutative73.1%
Simplified73.1%
Taylor expanded in n around 0 58.7%
+-commutative58.7%
unpow258.7%
distribute-rgt-out61.4%
*-commutative61.4%
*-commutative61.4%
Simplified61.4%
Taylor expanded in n around 0 66.4%
associate-*r*66.4%
*-commutative66.4%
associate-*l*66.4%
*-commutative66.4%
Simplified66.4%
Taylor expanded in M around inf 49.0%
distribute-lft-out49.0%
mul-1-neg49.0%
+-commutative49.0%
unpow249.0%
distribute-lft-out52.3%
+-commutative52.3%
mul-1-neg52.3%
unsub-neg52.3%
*-commutative52.3%
*-commutative52.3%
Simplified52.3%
if -3.49999999999999983e-178 < l < -2.70000000000000018e-240Initial program 53.9%
Taylor expanded in K around 0 94.5%
Taylor expanded in n around 0 61.6%
+-commutative61.6%
unpow261.6%
distribute-rgt-out61.7%
Simplified61.7%
Taylor expanded in n around inf 34.4%
Taylor expanded in m around inf 45.5%
associate-*r*45.5%
Simplified45.5%
if 700 < l Initial program 84.3%
associate-/l*84.3%
+-commutative84.3%
fabs-sub84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in n around 0 72.7%
+-commutative72.7%
unpow272.7%
distribute-rgt-out72.7%
*-commutative72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in n around 0 76.7%
associate-*r*76.7%
*-commutative76.7%
associate-*l*76.7%
*-commutative76.7%
Simplified76.7%
Taylor expanded in l around inf 88.2%
mul-1-neg88.2%
Simplified88.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Final simplification61.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- M))) (t_1 (* t_0 (exp (* n M)))))
(if (<= l -1.4e-63)
t_1
(if (<= l 1.05e-226)
(* t_0 (exp (* n (* m -0.5))))
(if (<= l 700.0) t_1 (* (cos M) (exp (- l))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(-M);
double t_1 = t_0 * exp((n * M));
double tmp;
if (l <= -1.4e-63) {
tmp = t_1;
} else if (l <= 1.05e-226) {
tmp = t_0 * exp((n * (m * -0.5)));
} else if (l <= 700.0) {
tmp = t_1;
} 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) :: t_1
real(8) :: tmp
t_0 = cos(-m_1)
t_1 = t_0 * exp((n * m_1))
if (l <= (-1.4d-63)) then
tmp = t_1
else if (l <= 1.05d-226) then
tmp = t_0 * exp((n * (m * (-0.5d0))))
else if (l <= 700.0d0) then
tmp = t_1
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);
double t_1 = t_0 * Math.exp((n * M));
double tmp;
if (l <= -1.4e-63) {
tmp = t_1;
} else if (l <= 1.05e-226) {
tmp = t_0 * Math.exp((n * (m * -0.5)));
} else if (l <= 700.0) {
tmp = t_1;
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(-M) t_1 = t_0 * math.exp((n * M)) tmp = 0 if l <= -1.4e-63: tmp = t_1 elif l <= 1.05e-226: tmp = t_0 * math.exp((n * (m * -0.5))) elif l <= 700.0: tmp = t_1 else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(-M)) t_1 = Float64(t_0 * exp(Float64(n * M))) tmp = 0.0 if (l <= -1.4e-63) tmp = t_1; elseif (l <= 1.05e-226) tmp = Float64(t_0 * exp(Float64(n * Float64(m * -0.5)))); elseif (l <= 700.0) tmp = t_1; 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); t_1 = t_0 * exp((n * M)); tmp = 0.0; if (l <= -1.4e-63) tmp = t_1; elseif (l <= 1.05e-226) tmp = t_0 * exp((n * (m * -0.5))); elseif (l <= 700.0) tmp = t_1; else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[(-M)], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -1.4e-63], t$95$1, If[LessEqual[l, 1.05e-226], N[(t$95$0 * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 700.0], t$95$1, N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(-M\right)\\
t_1 := t_0 \cdot e^{n \cdot M}\\
\mathbf{if}\;\ell \leq -1.4 \cdot 10^{-63}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 1.05 \cdot 10^{-226}:\\
\;\;\;\;t_0 \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\mathbf{elif}\;\ell \leq 700:\\
\;\;\;\;t_1\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -1.4000000000000001e-63 or 1.0500000000000001e-226 < l < 700Initial program 73.3%
Taylor expanded in K around 0 93.2%
Taylor expanded in n around 0 68.6%
+-commutative68.6%
unpow268.6%
distribute-rgt-out74.3%
Simplified74.3%
Taylor expanded in n around inf 39.7%
Taylor expanded in M around inf 37.1%
if -1.4000000000000001e-63 < l < 1.0500000000000001e-226Initial program 68.4%
Taylor expanded in K around 0 97.8%
Taylor expanded in n around 0 75.3%
+-commutative75.3%
unpow275.3%
distribute-rgt-out75.4%
Simplified75.4%
Taylor expanded in n around inf 43.4%
Taylor expanded in m around inf 41.0%
associate-*r*41.0%
Simplified41.0%
if 700 < l Initial program 84.3%
associate-/l*84.3%
+-commutative84.3%
fabs-sub84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in n around 0 72.7%
+-commutative72.7%
unpow272.7%
distribute-rgt-out72.7%
*-commutative72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in n around 0 76.7%
associate-*r*76.7%
*-commutative76.7%
associate-*l*76.7%
*-commutative76.7%
Simplified76.7%
Taylor expanded in l around inf 88.2%
mul-1-neg88.2%
Simplified88.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Final simplification50.8%
(FPCore (K m n M l) :precision binary64 (if (<= l 700.0) (* (cos (- M)) (exp (* n M))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 700.0) {
tmp = cos(-M) * exp((n * M));
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= 700.0d0) then
tmp = cos(-m_1) * exp((n * m_1))
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 <= 700.0) {
tmp = Math.cos(-M) * Math.exp((n * M));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 700.0: tmp = math.cos(-M) * math.exp((n * M)) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 700.0) tmp = Float64(cos(Float64(-M)) * exp(Float64(n * M))); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 700.0) tmp = cos(-M) * exp((n * M)); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 700.0], N[(N[Cos[(-M)], $MachinePrecision] * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 700:\\
\;\;\;\;\cos \left(-M\right) \cdot e^{n \cdot M}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < 700Initial program 71.4%
Taylor expanded in K around 0 95.0%
Taylor expanded in n around 0 71.2%
+-commutative71.2%
unpow271.2%
distribute-rgt-out74.7%
Simplified74.7%
Taylor expanded in n around inf 41.1%
Taylor expanded in M around inf 36.7%
if 700 < l Initial program 84.3%
associate-/l*84.3%
+-commutative84.3%
fabs-sub84.3%
+-commutative84.3%
Simplified84.3%
Taylor expanded in n around 0 72.7%
+-commutative72.7%
unpow272.7%
distribute-rgt-out72.7%
*-commutative72.7%
*-commutative72.7%
Simplified72.7%
Taylor expanded in n around 0 76.7%
associate-*r*76.7%
*-commutative76.7%
associate-*l*76.7%
*-commutative76.7%
Simplified76.7%
Taylor expanded in l around inf 88.2%
mul-1-neg88.2%
Simplified88.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Final simplification49.3%
(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 73.9%
associate-/l*74.0%
+-commutative74.0%
fabs-sub74.0%
+-commutative74.0%
Simplified74.0%
Taylor expanded in n around 0 59.6%
+-commutative59.6%
unpow259.6%
distribute-rgt-out61.6%
*-commutative61.6%
*-commutative61.6%
Simplified61.6%
Taylor expanded in n around 0 66.1%
associate-*r*66.1%
*-commutative66.1%
associate-*l*66.1%
*-commutative66.1%
Simplified66.1%
Taylor expanded in l around inf 28.6%
mul-1-neg28.6%
Simplified28.6%
Taylor expanded in K around 0 31.1%
cos-neg31.1%
Simplified31.1%
Final simplification31.1%
(FPCore (K m n M l) :precision binary64 (cos (- (* K (* m 0.5)) M)))
double code(double K, double m, double n, double M, double l) {
return cos(((K * (m * 0.5)) - 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(((k * (m * 0.5d0)) - m_1))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(((K * (m * 0.5)) - M));
}
def code(K, m, n, M, l): return math.cos(((K * (m * 0.5)) - M))
function code(K, m, n, M, l) return cos(Float64(Float64(K * Float64(m * 0.5)) - M)) end
function tmp = code(K, m, n, M, l) tmp = cos(((K * (m * 0.5)) - M)); end
code[K_, m_, n_, M_, l_] := N[Cos[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\cos \left(K \cdot \left(m \cdot 0.5\right) - M\right)
\end{array}
Initial program 73.9%
associate-/l*74.0%
+-commutative74.0%
fabs-sub74.0%
+-commutative74.0%
Simplified74.0%
Taylor expanded in n around 0 59.6%
+-commutative59.6%
unpow259.6%
distribute-rgt-out61.6%
*-commutative61.6%
*-commutative61.6%
Simplified61.6%
Taylor expanded in n around 0 66.1%
associate-*r*66.1%
*-commutative66.1%
associate-*l*66.1%
*-commutative66.1%
Simplified66.1%
Taylor expanded in l around inf 28.6%
mul-1-neg28.6%
Simplified28.6%
Taylor expanded in l around 0 8.8%
*-commutative8.8%
associate-*r*8.8%
Simplified8.8%
Final simplification8.8%
herbie shell --seed 2023334
(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)))))))