
(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 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (fabs (- n m)) (+ 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((n - m)) - (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((n - m)) - (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((n - m)) - (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((n - m)) - (l + math.pow((((m + n) * 0.5) - M), 2.0))))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(abs(Float64(n - m)) - 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((n - m)) - (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[(n - m), $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 M \cdot e^{\left|n - m\right| - \left(\ell + {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}
\end{array}
Initial program 81.7%
Taylor expanded in K around 0 97.7%
cos-neg97.7%
sub-neg97.7%
sub-neg97.7%
associate--r+97.7%
*-commutative97.7%
associate--r+97.7%
Simplified97.7%
Final simplification97.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= m -3.5e+46)
(* (cos M) (exp (- t_0 (pow (- (* (+ m n) 0.5) M) 2.0))))
(*
(cos M)
(exp (+ (- t_0 l) (* (- (* n 0.5) M) (- (- M m) (* n 0.5)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (m <= -3.5e+46) {
tmp = cos(M) * exp((t_0 - pow((((m + n) * 0.5) - M), 2.0)));
} else {
tmp = cos(M) * exp(((t_0 - l) + (((n * 0.5) - M) * ((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) :: t_0
real(8) :: tmp
t_0 = abs((n - m))
if (m <= (-3.5d+46)) then
tmp = cos(m_1) * exp((t_0 - ((((m + n) * 0.5d0) - m_1) ** 2.0d0)))
else
tmp = cos(m_1) * exp(((t_0 - l) + (((n * 0.5d0) - m_1) * ((m_1 - 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((n - m));
double tmp;
if (m <= -3.5e+46) {
tmp = Math.cos(M) * Math.exp((t_0 - Math.pow((((m + n) * 0.5) - M), 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5)))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if m <= -3.5e+46: tmp = math.cos(M) * math.exp((t_0 - math.pow((((m + n) * 0.5) - M), 2.0))) else: tmp = math.cos(M) * math.exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5))))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (m <= -3.5e+46) tmp = Float64(cos(M) * exp(Float64(t_0 - (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - m) - Float64(n * 0.5)))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (m <= -3.5e+46) tmp = cos(M) * exp((t_0 - ((((m + n) * 0.5) - M) ^ 2.0))); else tmp = cos(M) * exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -3.5e+46], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - m), $MachinePrecision] - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;m \leq -3.5 \cdot 10^{+46}:\\
\;\;\;\;\cos M \cdot e^{t\_0 - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(t\_0 - \ell\right) + \left(n \cdot 0.5 - M\right) \cdot \left(\left(M - m\right) - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < -3.49999999999999985e46Initial program 67.3%
Taylor expanded in l around 0 67.3%
*-commutative67.3%
*-commutative67.3%
*-commutative67.3%
associate-*r*67.3%
Simplified67.3%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
if -3.49999999999999985e46 < m Initial program 85.7%
Taylor expanded in m around 0 70.0%
+-commutative70.0%
unpow270.0%
distribute-rgt-out73.0%
*-commutative73.0%
*-commutative73.0%
Simplified73.0%
Taylor expanded in K around 0 82.9%
cos-neg82.9%
associate--r+82.9%
sub-neg82.9%
+-commutative82.9%
neg-mul-182.9%
associate--l+82.9%
sub-neg82.9%
+-commutative82.9%
neg-mul-182.9%
*-commutative82.9%
*-commutative82.9%
neg-mul-182.9%
+-commutative82.9%
sub-neg82.9%
Simplified82.9%
Final simplification86.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= m -8.5e+139)
(* (cos M) (exp (- t_0 (+ l (* 0.25 (pow m 2.0))))))
(if (<= m -3.5e+46)
(* 0.5 (* (* m K) (* M (exp (- t_0 (+ (* 0.25 (pow (+ m n) 2.0)) l))))))
(*
(cos M)
(exp (+ (- t_0 l) (* (- (* n 0.5) M) (- (- M m) (* n 0.5))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (m <= -8.5e+139) {
tmp = cos(M) * exp((t_0 - (l + (0.25 * pow(m, 2.0)))));
} else if (m <= -3.5e+46) {
tmp = 0.5 * ((m * K) * (M * exp((t_0 - ((0.25 * pow((m + n), 2.0)) + l)))));
} else {
tmp = cos(M) * exp(((t_0 - l) + (((n * 0.5) - M) * ((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) :: t_0
real(8) :: tmp
t_0 = abs((n - m))
if (m <= (-8.5d+139)) then
tmp = cos(m_1) * exp((t_0 - (l + (0.25d0 * (m ** 2.0d0)))))
else if (m <= (-3.5d+46)) then
tmp = 0.5d0 * ((m * k) * (m_1 * exp((t_0 - ((0.25d0 * ((m + n) ** 2.0d0)) + l)))))
else
tmp = cos(m_1) * exp(((t_0 - l) + (((n * 0.5d0) - m_1) * ((m_1 - 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((n - m));
double tmp;
if (m <= -8.5e+139) {
tmp = Math.cos(M) * Math.exp((t_0 - (l + (0.25 * Math.pow(m, 2.0)))));
} else if (m <= -3.5e+46) {
tmp = 0.5 * ((m * K) * (M * Math.exp((t_0 - ((0.25 * Math.pow((m + n), 2.0)) + l)))));
} else {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5)))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if m <= -8.5e+139: tmp = math.cos(M) * math.exp((t_0 - (l + (0.25 * math.pow(m, 2.0))))) elif m <= -3.5e+46: tmp = 0.5 * ((m * K) * (M * math.exp((t_0 - ((0.25 * math.pow((m + n), 2.0)) + l))))) else: tmp = math.cos(M) * math.exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5))))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (m <= -8.5e+139) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(l + Float64(0.25 * (m ^ 2.0)))))); elseif (m <= -3.5e+46) tmp = Float64(0.5 * Float64(Float64(m * K) * Float64(M * exp(Float64(t_0 - Float64(Float64(0.25 * (Float64(m + n) ^ 2.0)) + l)))))); else tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - m) - Float64(n * 0.5)))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (m <= -8.5e+139) tmp = cos(M) * exp((t_0 - (l + (0.25 * (m ^ 2.0))))); elseif (m <= -3.5e+46) tmp = 0.5 * ((m * K) * (M * exp((t_0 - ((0.25 * ((m + n) ^ 2.0)) + l))))); else tmp = cos(M) * exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -8.5e+139], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(l + N[(0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -3.5e+46], N[(0.5 * N[(N[(m * K), $MachinePrecision] * N[(M * N[Exp[N[(t$95$0 - N[(N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - m), $MachinePrecision] - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;m \leq -8.5 \cdot 10^{+139}:\\
\;\;\;\;\cos M \cdot e^{t\_0 - \left(\ell + 0.25 \cdot {m}^{2}\right)}\\
\mathbf{elif}\;m \leq -3.5 \cdot 10^{+46}:\\
\;\;\;\;0.5 \cdot \left(\left(m \cdot K\right) \cdot \left(M \cdot e^{t\_0 - \left(0.25 \cdot {\left(m + n\right)}^{2} + \ell\right)}\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(t\_0 - \ell\right) + \left(n \cdot 0.5 - M\right) \cdot \left(\left(M - m\right) - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < -8.5e139Initial program 56.4%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
sub-neg100.0%
sub-neg100.0%
associate--r+100.0%
*-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in m around inf 97.5%
if -8.5e139 < m < -3.49999999999999985e46Initial program 93.8%
Taylor expanded in K around 0 93.8%
cos-neg93.8%
sin-neg93.8%
Simplified93.8%
Taylor expanded in m around inf 100.0%
Simplified100.0%
Taylor expanded in M around 0 93.8%
+-commutative87.6%
Simplified93.8%
if -3.49999999999999985e46 < m Initial program 85.7%
Taylor expanded in m around 0 70.0%
+-commutative70.0%
unpow270.0%
distribute-rgt-out73.0%
*-commutative73.0%
*-commutative73.0%
Simplified73.0%
Taylor expanded in K around 0 82.9%
cos-neg82.9%
associate--r+82.9%
sub-neg82.9%
+-commutative82.9%
neg-mul-182.9%
associate--l+82.9%
sub-neg82.9%
+-commutative82.9%
neg-mul-182.9%
*-commutative82.9%
*-commutative82.9%
neg-mul-182.9%
+-commutative82.9%
sub-neg82.9%
Simplified82.9%
Final simplification85.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= m -3.5e+46)
(* 0.5 (* (* M (exp (- t_0 (+ (* 0.25 (pow (+ m n) 2.0)) l)))) (* n K)))
(*
(cos M)
(exp (+ (- t_0 l) (* (- (* n 0.5) M) (- (- M m) (* n 0.5)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (m <= -3.5e+46) {
tmp = 0.5 * ((M * exp((t_0 - ((0.25 * pow((m + n), 2.0)) + l)))) * (n * K));
} else {
tmp = cos(M) * exp(((t_0 - l) + (((n * 0.5) - M) * ((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) :: t_0
real(8) :: tmp
t_0 = abs((n - m))
if (m <= (-3.5d+46)) then
tmp = 0.5d0 * ((m_1 * exp((t_0 - ((0.25d0 * ((m + n) ** 2.0d0)) + l)))) * (n * k))
else
tmp = cos(m_1) * exp(((t_0 - l) + (((n * 0.5d0) - m_1) * ((m_1 - 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((n - m));
double tmp;
if (m <= -3.5e+46) {
tmp = 0.5 * ((M * Math.exp((t_0 - ((0.25 * Math.pow((m + n), 2.0)) + l)))) * (n * K));
} else {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5)))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if m <= -3.5e+46: tmp = 0.5 * ((M * math.exp((t_0 - ((0.25 * math.pow((m + n), 2.0)) + l)))) * (n * K)) else: tmp = math.cos(M) * math.exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5))))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (m <= -3.5e+46) tmp = Float64(0.5 * Float64(Float64(M * exp(Float64(t_0 - Float64(Float64(0.25 * (Float64(m + n) ^ 2.0)) + l)))) * Float64(n * K))); else tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - m) - Float64(n * 0.5)))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (m <= -3.5e+46) tmp = 0.5 * ((M * exp((t_0 - ((0.25 * ((m + n) ^ 2.0)) + l)))) * (n * K)); else tmp = cos(M) * exp(((t_0 - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -3.5e+46], N[(0.5 * N[(N[(M * N[Exp[N[(t$95$0 - N[(N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[(n * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - m), $MachinePrecision] - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;m \leq -3.5 \cdot 10^{+46}:\\
\;\;\;\;0.5 \cdot \left(\left(M \cdot e^{t\_0 - \left(0.25 \cdot {\left(m + n\right)}^{2} + \ell\right)}\right) \cdot \left(n \cdot K\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(t\_0 - \ell\right) + \left(n \cdot 0.5 - M\right) \cdot \left(\left(M - m\right) - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < -3.49999999999999985e46Initial program 67.3%
Taylor expanded in K around 0 83.6%
cos-neg83.6%
sin-neg83.6%
Simplified83.6%
Taylor expanded in n around inf 100.0%
Simplified89.1%
Taylor expanded in M around 0 87.3%
+-commutative87.3%
Simplified87.3%
if -3.49999999999999985e46 < m Initial program 85.7%
Taylor expanded in m around 0 70.0%
+-commutative70.0%
unpow270.0%
distribute-rgt-out73.0%
*-commutative73.0%
*-commutative73.0%
Simplified73.0%
Taylor expanded in K around 0 82.9%
cos-neg82.9%
associate--r+82.9%
sub-neg82.9%
+-commutative82.9%
neg-mul-182.9%
associate--l+82.9%
sub-neg82.9%
+-commutative82.9%
neg-mul-182.9%
*-commutative82.9%
*-commutative82.9%
neg-mul-182.9%
+-commutative82.9%
sub-neg82.9%
Simplified82.9%
Final simplification83.9%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -3800000000000.0) (not (<= M 34.0))) (* (cos M) (exp (- (pow M 2.0)))) (* (cos M) (exp (+ (* M (- M (* n 0.5))) (- (- m l) n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -3800000000000.0) || !(M <= 34.0)) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp(((M * (M - (n * 0.5))) + ((m - l) - n)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m_1 <= (-3800000000000.0d0)) .or. (.not. (m_1 <= 34.0d0))) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp(((m_1 * (m_1 - (n * 0.5d0))) + ((m - l) - n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -3800000000000.0) || !(M <= 34.0)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp(((M * (M - (n * 0.5))) + ((m - l) - n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -3800000000000.0) or not (M <= 34.0): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp(((M * (M - (n * 0.5))) + ((m - l) - n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -3800000000000.0) || !(M <= 34.0)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(M * Float64(M - Float64(n * 0.5))) + Float64(Float64(m - l) - n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -3800000000000.0) || ~((M <= 34.0))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp(((M * (M - (n * 0.5))) + ((m - l) - n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -3800000000000.0], N[Not[LessEqual[M, 34.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(M * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(m - l), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -3800000000000 \lor \neg \left(M \leq 34\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(M - n \cdot 0.5\right) + \left(\left(m - \ell\right) - n\right)}\\
\end{array}
\end{array}
if M < -3.8e12 or 34 < M Initial program 86.4%
Taylor expanded in l around 0 84.8%
*-commutative84.8%
*-commutative84.8%
*-commutative84.8%
associate-*r*84.8%
Simplified84.8%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in M around inf 98.4%
mul-1-neg98.4%
Simplified98.4%
if -3.8e12 < M < 34Initial program 77.3%
exp-diff23.8%
associate-*r/23.8%
Applied egg-rr21.3%
associate-/l*21.3%
fma-neg21.3%
associate-*r*21.3%
*-commutative21.3%
*-commutative21.3%
associate-*r*21.3%
div-exp24.7%
associate--r-24.7%
+-commutative24.7%
Simplified24.7%
Taylor expanded in m around 0 35.9%
*-commutative35.9%
*-commutative35.9%
*-commutative35.9%
unpow235.9%
distribute-lft-in37.4%
sub-neg37.4%
*-commutative37.4%
+-commutative37.4%
associate-+r+37.4%
sub-neg37.4%
*-commutative37.4%
Simplified37.4%
Taylor expanded in K around 0 46.0%
cos-neg82.2%
Simplified46.0%
Taylor expanded in M around inf 61.8%
neg-mul-161.8%
Simplified61.8%
Final simplification79.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos (- (* 0.5 (* m K)) M)) (exp (* M (- m M))))))
(if (<= M -1.55e+192)
t_0
(if (<= M -1.55e+126)
(* (cos M) (exp (* m (- (+ (* n 0.5) 1.0) M))))
(if (or (<= M -1.35e+47) (not (<= M 1.2e+17)))
t_0
(* (cos M) (exp (+ (* M (- M (* n 0.5))) (- (- m l) n)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(((0.5 * (m * K)) - M)) * exp((M * (m - M)));
double tmp;
if (M <= -1.55e+192) {
tmp = t_0;
} else if (M <= -1.55e+126) {
tmp = cos(M) * exp((m * (((n * 0.5) + 1.0) - M)));
} else if ((M <= -1.35e+47) || !(M <= 1.2e+17)) {
tmp = t_0;
} else {
tmp = cos(M) * exp(((M * (M - (n * 0.5))) + ((m - l) - n)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = cos(((0.5d0 * (m * k)) - m_1)) * exp((m_1 * (m - m_1)))
if (m_1 <= (-1.55d+192)) then
tmp = t_0
else if (m_1 <= (-1.55d+126)) then
tmp = cos(m_1) * exp((m * (((n * 0.5d0) + 1.0d0) - m_1)))
else if ((m_1 <= (-1.35d+47)) .or. (.not. (m_1 <= 1.2d+17))) then
tmp = t_0
else
tmp = cos(m_1) * exp(((m_1 * (m_1 - (n * 0.5d0))) + ((m - l) - n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos(((0.5 * (m * K)) - M)) * Math.exp((M * (m - M)));
double tmp;
if (M <= -1.55e+192) {
tmp = t_0;
} else if (M <= -1.55e+126) {
tmp = Math.cos(M) * Math.exp((m * (((n * 0.5) + 1.0) - M)));
} else if ((M <= -1.35e+47) || !(M <= 1.2e+17)) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp(((M * (M - (n * 0.5))) + ((m - l) - n)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(((0.5 * (m * K)) - M)) * math.exp((M * (m - M))) tmp = 0 if M <= -1.55e+192: tmp = t_0 elif M <= -1.55e+126: tmp = math.cos(M) * math.exp((m * (((n * 0.5) + 1.0) - M))) elif (M <= -1.35e+47) or not (M <= 1.2e+17): tmp = t_0 else: tmp = math.cos(M) * math.exp(((M * (M - (n * 0.5))) + ((m - l) - n))) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(Float64(Float64(0.5 * Float64(m * K)) - M)) * exp(Float64(M * Float64(m - M)))) tmp = 0.0 if (M <= -1.55e+192) tmp = t_0; elseif (M <= -1.55e+126) tmp = Float64(cos(M) * exp(Float64(m * Float64(Float64(Float64(n * 0.5) + 1.0) - M)))); elseif ((M <= -1.35e+47) || !(M <= 1.2e+17)) tmp = t_0; else tmp = Float64(cos(M) * exp(Float64(Float64(M * Float64(M - Float64(n * 0.5))) + Float64(Float64(m - l) - n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(((0.5 * (m * K)) - M)) * exp((M * (m - M))); tmp = 0.0; if (M <= -1.55e+192) tmp = t_0; elseif (M <= -1.55e+126) tmp = cos(M) * exp((m * (((n * 0.5) + 1.0) - M))); elseif ((M <= -1.35e+47) || ~((M <= 1.2e+17))) tmp = t_0; else tmp = cos(M) * exp(((M * (M - (n * 0.5))) + ((m - l) - n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[N[(N[(0.5 * N[(m * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -1.55e+192], t$95$0, If[LessEqual[M, -1.55e+126], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(N[(N[(n * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[M, -1.35e+47], N[Not[LessEqual[M, 1.2e+17]], $MachinePrecision]], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(M * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[(m - l), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot \left(m \cdot K\right) - M\right) \cdot e^{M \cdot \left(m - M\right)}\\
\mathbf{if}\;M \leq -1.55 \cdot 10^{+192}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq -1.55 \cdot 10^{+126}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(\left(n \cdot 0.5 + 1\right) - M\right)}\\
\mathbf{elif}\;M \leq -1.35 \cdot 10^{+47} \lor \neg \left(M \leq 1.2 \cdot 10^{+17}\right):\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(M - n \cdot 0.5\right) + \left(\left(m - \ell\right) - n\right)}\\
\end{array}
\end{array}
if M < -1.5499999999999999e192 or -1.55e126 < M < -1.34999999999999998e47 or 1.2e17 < M Initial program 92.0%
Taylor expanded in m around 0 77.0%
+-commutative77.0%
unpow277.0%
distribute-rgt-out87.1%
*-commutative87.1%
*-commutative87.1%
Simplified87.1%
Taylor expanded in n around 0 79.2%
*-commutative79.2%
mul-1-neg79.2%
unsub-neg79.2%
Simplified79.2%
Taylor expanded in M around inf 78.1%
+-commutative78.1%
mul-1-neg78.1%
unpow278.1%
distribute-rgt-neg-in78.1%
distribute-lft-in84.1%
sub-neg84.1%
Simplified84.1%
if -1.5499999999999999e192 < M < -1.55e126Initial program 62.5%
exp-diff12.5%
associate-*r/12.5%
Applied egg-rr0.5%
associate-/l*0.5%
fma-neg0.5%
associate-*r*0.5%
*-commutative0.5%
*-commutative0.5%
associate-*r*0.5%
div-exp1.0%
associate--r-1.0%
+-commutative1.0%
Simplified1.0%
Taylor expanded in m around 0 7.0%
*-commutative7.0%
*-commutative7.0%
*-commutative7.0%
unpow27.0%
distribute-lft-in13.3%
sub-neg13.3%
*-commutative13.3%
+-commutative13.3%
associate-+r+13.3%
sub-neg13.3%
*-commutative13.3%
Simplified13.3%
Taylor expanded in K around 0 20.0%
cos-neg100.0%
Simplified20.0%
Taylor expanded in m around inf 45.0%
*-commutative45.0%
Simplified45.0%
if -1.34999999999999998e47 < M < 1.2e17Initial program 76.6%
exp-diff23.0%
associate-*r/23.0%
Applied egg-rr20.7%
associate-/l*20.7%
fma-neg20.7%
associate-*r*20.7%
*-commutative20.7%
*-commutative20.7%
associate-*r*20.7%
div-exp23.8%
associate--r-23.8%
+-commutative23.8%
Simplified23.8%
Taylor expanded in m around 0 35.7%
*-commutative35.7%
*-commutative35.7%
*-commutative35.7%
unpow235.7%
distribute-lft-in37.2%
sub-neg37.2%
*-commutative37.2%
+-commutative37.2%
associate-+r+37.2%
sub-neg37.2%
*-commutative37.2%
Simplified37.2%
Taylor expanded in K around 0 45.2%
cos-neg82.7%
Simplified45.2%
Taylor expanded in M around inf 59.3%
neg-mul-159.3%
Simplified59.3%
Final simplification68.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* -0.25 (pow n 2.0)))))
(if (<= n -2.9e-19)
t_0
(if (<= n 2.2e-263)
(* (cos M) (exp (* m (- (+ (* n 0.5) 1.0) M))))
(if (<= n 1.3e-28)
(* (cos (- (* 0.5 (* m K)) M)) (exp (* M (- m M))))
(if (<= n 54.0) (* (cos M) (exp (- l))) t_0))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((-0.25 * pow(n, 2.0)));
double tmp;
if (n <= -2.9e-19) {
tmp = t_0;
} else if (n <= 2.2e-263) {
tmp = cos(M) * exp((m * (((n * 0.5) + 1.0) - M)));
} else if (n <= 1.3e-28) {
tmp = cos(((0.5 * (m * K)) - M)) * exp((M * (m - M)));
} else if (n <= 54.0) {
tmp = cos(M) * exp(-l);
} 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 = exp(((-0.25d0) * (n ** 2.0d0)))
if (n <= (-2.9d-19)) then
tmp = t_0
else if (n <= 2.2d-263) then
tmp = cos(m_1) * exp((m * (((n * 0.5d0) + 1.0d0) - m_1)))
else if (n <= 1.3d-28) then
tmp = cos(((0.5d0 * (m * k)) - m_1)) * exp((m_1 * (m - m_1)))
else if (n <= 54.0d0) then
tmp = cos(m_1) * exp(-l)
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.exp((-0.25 * Math.pow(n, 2.0)));
double tmp;
if (n <= -2.9e-19) {
tmp = t_0;
} else if (n <= 2.2e-263) {
tmp = Math.cos(M) * Math.exp((m * (((n * 0.5) + 1.0) - M)));
} else if (n <= 1.3e-28) {
tmp = Math.cos(((0.5 * (m * K)) - M)) * Math.exp((M * (m - M)));
} else if (n <= 54.0) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp((-0.25 * math.pow(n, 2.0))) tmp = 0 if n <= -2.9e-19: tmp = t_0 elif n <= 2.2e-263: tmp = math.cos(M) * math.exp((m * (((n * 0.5) + 1.0) - M))) elif n <= 1.3e-28: tmp = math.cos(((0.5 * (m * K)) - M)) * math.exp((M * (m - M))) elif n <= 54.0: tmp = math.cos(M) * math.exp(-l) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-0.25 * (n ^ 2.0))) tmp = 0.0 if (n <= -2.9e-19) tmp = t_0; elseif (n <= 2.2e-263) tmp = Float64(cos(M) * exp(Float64(m * Float64(Float64(Float64(n * 0.5) + 1.0) - M)))); elseif (n <= 1.3e-28) tmp = Float64(cos(Float64(Float64(0.5 * Float64(m * K)) - M)) * exp(Float64(M * Float64(m - M)))); elseif (n <= 54.0) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp((-0.25 * (n ^ 2.0))); tmp = 0.0; if (n <= -2.9e-19) tmp = t_0; elseif (n <= 2.2e-263) tmp = cos(M) * exp((m * (((n * 0.5) + 1.0) - M))); elseif (n <= 1.3e-28) tmp = cos(((0.5 * (m * K)) - M)) * exp((M * (m - M))); elseif (n <= 54.0) tmp = cos(M) * exp(-l); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, -2.9e-19], t$95$0, If[LessEqual[n, 2.2e-263], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(N[(N[(n * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 1.3e-28], N[(N[Cos[N[(N[(0.5 * N[(m * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], t$95$0]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot {n}^{2}}\\
\mathbf{if}\;n \leq -2.9 \cdot 10^{-19}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 2.2 \cdot 10^{-263}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(\left(n \cdot 0.5 + 1\right) - M\right)}\\
\mathbf{elif}\;n \leq 1.3 \cdot 10^{-28}:\\
\;\;\;\;\cos \left(0.5 \cdot \left(m \cdot K\right) - M\right) \cdot e^{M \cdot \left(m - M\right)}\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if n < -2.9e-19 or 54 < n Initial program 77.9%
Taylor expanded in l around 0 75.1%
*-commutative75.1%
*-commutative75.1%
*-commutative75.1%
associate-*r*75.1%
Simplified75.1%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Taylor expanded in n around inf 91.0%
Taylor expanded in M around 0 91.0%
if -2.9e-19 < n < 2.2e-263Initial program 89.2%
exp-diff47.9%
associate-*r/47.9%
Applied egg-rr26.4%
associate-/l*26.4%
fma-neg26.4%
associate-*r*26.4%
*-commutative26.4%
*-commutative26.4%
associate-*r*26.4%
div-exp26.7%
associate--r-26.7%
+-commutative26.7%
Simplified26.7%
Taylor expanded in m around 0 32.8%
*-commutative32.8%
*-commutative32.8%
*-commutative32.8%
unpow232.8%
distribute-lft-in36.0%
sub-neg36.0%
*-commutative36.0%
+-commutative36.0%
associate-+r+36.0%
sub-neg36.0%
*-commutative36.0%
Simplified36.0%
Taylor expanded in K around 0 42.2%
cos-neg84.5%
Simplified42.2%
Taylor expanded in m around inf 45.7%
*-commutative45.7%
Simplified45.7%
if 2.2e-263 < n < 1.3e-28Initial program 85.7%
Taylor expanded in m around 0 59.6%
+-commutative59.6%
unpow259.6%
distribute-rgt-out59.6%
*-commutative59.6%
*-commutative59.6%
Simplified59.6%
Taylor expanded in n around 0 59.6%
*-commutative59.6%
mul-1-neg59.6%
unsub-neg59.6%
Simplified59.6%
Taylor expanded in M around inf 57.9%
+-commutative57.9%
mul-1-neg57.9%
unpow257.9%
distribute-rgt-neg-in57.9%
distribute-lft-in57.9%
sub-neg57.9%
Simplified57.9%
if 1.3e-28 < n < 54Initial program 50.4%
Taylor expanded in m around 0 25.8%
+-commutative25.8%
unpow225.8%
distribute-rgt-out25.8%
*-commutative25.8%
*-commutative25.8%
Simplified25.8%
Taylor expanded in n around 0 25.8%
*-commutative25.8%
mul-1-neg25.8%
unsub-neg25.8%
Simplified25.8%
Taylor expanded in l around inf 26.2%
mul-1-neg26.2%
Simplified26.2%
Taylor expanded in m around 0 27.0%
cos-neg27.0%
Simplified27.0%
Final simplification72.5%
(FPCore (K m n M l) :precision binary64 (if (or (<= n -53.0) (not (<= n 56.0))) (exp (* -0.25 (pow n 2.0))) (* (cos M) (exp (- (+ m (* 0.5 (* n (+ m (* n 0.5))))) (+ n l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -53.0) || !(n <= 56.0)) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else {
tmp = cos(M) * exp(((m + (0.5 * (n * (m + (n * 0.5))))) - (n + l)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((n <= (-53.0d0)) .or. (.not. (n <= 56.0d0))) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else
tmp = cos(m_1) * exp(((m + (0.5d0 * (n * (m + (n * 0.5d0))))) - (n + l)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -53.0) || !(n <= 56.0)) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((m + (0.5 * (n * (m + (n * 0.5))))) - (n + l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -53.0) or not (n <= 56.0): tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos(M) * math.exp(((m + (0.5 * (n * (m + (n * 0.5))))) - (n + l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -53.0) || !(n <= 56.0)) tmp = exp(Float64(-0.25 * (n ^ 2.0))); else tmp = Float64(cos(M) * exp(Float64(Float64(m + Float64(0.5 * Float64(n * Float64(m + Float64(n * 0.5))))) - Float64(n + l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((n <= -53.0) || ~((n <= 56.0))) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos(M) * exp(((m + (0.5 * (n * (m + (n * 0.5))))) - (n + l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -53.0], N[Not[LessEqual[n, 56.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m + N[(0.5 * N[(n * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -53 \lor \neg \left(n \leq 56\right):\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(m + 0.5 \cdot \left(n \cdot \left(m + n \cdot 0.5\right)\right)\right) - \left(n + \ell\right)}\\
\end{array}
\end{array}
if n < -53 or 56 < n Initial program 77.4%
Taylor expanded in l around 0 74.5%
*-commutative74.5%
*-commutative74.5%
*-commutative74.5%
associate-*r*74.5%
Simplified74.5%
Taylor expanded in K around 0 95.6%
cos-neg95.6%
Simplified95.6%
Taylor expanded in n around inf 95.6%
Taylor expanded in M around 0 95.6%
if -53 < n < 56Initial program 86.4%
exp-diff43.3%
associate-*r/43.3%
Applied egg-rr21.1%
associate-/l*21.1%
fma-neg21.1%
associate-*r*21.1%
*-commutative21.1%
*-commutative21.1%
associate-*r*21.1%
div-exp23.1%
associate--r-23.1%
+-commutative23.1%
Simplified23.1%
Taylor expanded in m around 0 34.3%
*-commutative34.3%
*-commutative34.3%
*-commutative34.3%
unpow234.3%
distribute-lft-in35.9%
sub-neg35.9%
*-commutative35.9%
+-commutative35.9%
associate-+r+35.9%
sub-neg35.9%
*-commutative35.9%
Simplified35.9%
Taylor expanded in K around 0 42.5%
cos-neg84.3%
Simplified42.5%
Taylor expanded in M around 0 54.7%
Final simplification75.9%
(FPCore (K m n M l) :precision binary64 (if (or (<= n -2.9e-19) (not (<= n 54.0))) (exp (* -0.25 (pow n 2.0))) (* (cos M) (exp (* m (- (+ (* n 0.5) 1.0) M))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -2.9e-19) || !(n <= 54.0)) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else {
tmp = cos(M) * exp((m * (((n * 0.5) + 1.0) - 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 ((n <= (-2.9d-19)) .or. (.not. (n <= 54.0d0))) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else
tmp = cos(m_1) * exp((m * (((n * 0.5d0) + 1.0d0) - m_1)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -2.9e-19) || !(n <= 54.0)) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp((m * (((n * 0.5) + 1.0) - M)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -2.9e-19) or not (n <= 54.0): tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos(M) * math.exp((m * (((n * 0.5) + 1.0) - M))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -2.9e-19) || !(n <= 54.0)) tmp = exp(Float64(-0.25 * (n ^ 2.0))); else tmp = Float64(cos(M) * exp(Float64(m * Float64(Float64(Float64(n * 0.5) + 1.0) - M)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((n <= -2.9e-19) || ~((n <= 54.0))) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos(M) * exp((m * (((n * 0.5) + 1.0) - M))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -2.9e-19], N[Not[LessEqual[n, 54.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(N[(N[(n * 0.5), $MachinePrecision] + 1.0), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.9 \cdot 10^{-19} \lor \neg \left(n \leq 54\right):\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(\left(n \cdot 0.5 + 1\right) - M\right)}\\
\end{array}
\end{array}
if n < -2.9e-19 or 54 < n Initial program 77.9%
Taylor expanded in l around 0 75.1%
*-commutative75.1%
*-commutative75.1%
*-commutative75.1%
associate-*r*75.1%
Simplified75.1%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Taylor expanded in n around inf 91.0%
Taylor expanded in M around 0 91.0%
if -2.9e-19 < n < 54Initial program 86.4%
exp-diff45.0%
associate-*r/45.0%
Applied egg-rr22.4%
associate-/l*22.4%
fma-neg22.4%
associate-*r*22.4%
*-commutative22.4%
*-commutative22.4%
associate-*r*22.4%
div-exp24.4%
associate--r-24.4%
+-commutative24.4%
Simplified24.4%
Taylor expanded in m around 0 35.4%
*-commutative35.4%
*-commutative35.4%
*-commutative35.4%
unpow235.4%
distribute-lft-in37.2%
sub-neg37.2%
*-commutative37.2%
+-commutative37.2%
associate-+r+37.2%
sub-neg37.2%
*-commutative37.2%
Simplified37.2%
Taylor expanded in K around 0 44.0%
cos-neg84.0%
Simplified44.0%
Taylor expanded in m around inf 46.0%
*-commutative46.0%
Simplified46.0%
Final simplification70.6%
(FPCore (K m n M l) :precision binary64 (if (or (<= n -2.4e-47) (not (<= n 54.0))) (exp (* -0.25 (pow n 2.0))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -2.4e-47) || !(n <= 54.0)) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((n <= (-2.4d-47)) .or. (.not. (n <= 54.0d0))) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -2.4e-47) || !(n <= 54.0)) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -2.4e-47) or not (n <= 54.0): tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -2.4e-47) || !(n <= 54.0)) tmp = exp(Float64(-0.25 * (n ^ 2.0))); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((n <= -2.4e-47) || ~((n <= 54.0))) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -2.4e-47], N[Not[LessEqual[n, 54.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.4 \cdot 10^{-47} \lor \neg \left(n \leq 54\right):\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if n < -2.3999999999999999e-47 or 54 < n Initial program 78.6%
Taylor expanded in l around 0 75.9%
*-commutative75.9%
*-commutative75.9%
*-commutative75.9%
associate-*r*75.9%
Simplified75.9%
Taylor expanded in K around 0 95.4%
cos-neg95.4%
Simplified95.4%
Taylor expanded in n around inf 88.7%
Taylor expanded in M around 0 88.7%
if -2.3999999999999999e-47 < n < 54Initial program 85.8%
Taylor expanded in m around 0 59.1%
+-commutative59.1%
unpow259.1%
distribute-rgt-out61.0%
*-commutative61.0%
*-commutative61.0%
Simplified61.0%
Taylor expanded in n around 0 61.0%
*-commutative61.0%
mul-1-neg61.0%
unsub-neg61.0%
Simplified61.0%
Taylor expanded in l around inf 36.7%
mul-1-neg36.7%
Simplified36.7%
Taylor expanded in m around 0 41.2%
cos-neg41.2%
Simplified41.2%
Final simplification68.1%
(FPCore (K m n M l) :precision binary64 (exp (* -0.25 (pow n 2.0))))
double code(double K, double m, double n, double M, double l) {
return exp((-0.25 * pow(n, 2.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(((-0.25d0) * (n ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((-0.25 * Math.pow(n, 2.0)));
}
def code(K, m, n, M, l): return math.exp((-0.25 * math.pow(n, 2.0)))
function code(K, m, n, M, l) return exp(Float64(-0.25 * (n ^ 2.0))) end
function tmp = code(K, m, n, M, l) tmp = exp((-0.25 * (n ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{-0.25 \cdot {n}^{2}}
\end{array}
Initial program 81.7%
Taylor expanded in l around 0 74.9%
*-commutative74.9%
*-commutative74.9%
*-commutative74.9%
associate-*r*74.9%
Simplified74.9%
Taylor expanded in K around 0 90.1%
cos-neg90.1%
Simplified90.1%
Taylor expanded in n around inf 55.3%
Taylor expanded in M around 0 55.3%
Final simplification55.3%
(FPCore (K m n M l) :precision binary64 (cos M))
double code(double K, double m, double n, double M, double l) {
return cos(M);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
def code(K, m, n, M, l): return math.cos(M)
function code(K, m, n, M, l) return cos(M) end
function tmp = code(K, m, n, M, l) tmp = cos(M); end
code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
\\
\cos M
\end{array}
Initial program 81.7%
Taylor expanded in l around 0 74.9%
*-commutative74.9%
*-commutative74.9%
*-commutative74.9%
associate-*r*74.9%
Simplified74.9%
Taylor expanded in K around 0 90.1%
cos-neg90.1%
Simplified90.1%
Taylor expanded in n around inf 55.3%
Taylor expanded in n around 0 7.3%
Final simplification7.3%
herbie shell --seed 2024043
(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)))))))