
(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 (- (* (+ n m) 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((((n + m) * 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 + ((((n + m) * 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((((n + m) * 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((((n + m) * 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(n + m) * 0.5) - M) ^ 2.0))))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((abs((n - m)) - (l + ((((n + m) * 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[(n + m), $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(n + m\right) \cdot 0.5 - M\right)}^{2}\right)}
\end{array}
Initial program 72.5%
associate-/l*72.9%
+-commutative72.9%
associate-/l*72.5%
associate-/l*72.9%
+-commutative72.9%
exp-diff24.8%
sub-neg24.8%
exp-sum20.1%
associate-/r*20.1%
exp-diff25.6%
Simplified72.9%
Taylor expanded in K around 0 96.5%
Simplified96.5%
Final simplification96.5%
(FPCore (K m n M l)
:precision binary64
(if (<= m -9.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(cos M)
(exp (+ (- (fabs (- n m)) l) (* (- (* n 0.5) M) (- (- M m) (* n 0.5))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -9.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp(((fabs((n - m)) - 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) :: tmp
if (m <= (-9.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((abs((n - m)) - 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 tmp;
if (m <= -9.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((Math.abs((n - m)) - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -9.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp(((math.fabs((n - m)) - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -9.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(n - m)) - 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) tmp = 0.0; if (m <= -9.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp(((abs((n - m)) - l) + (((n * 0.5) - M) * ((M - m) - (n * 0.5))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -9.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - 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}
\mathbf{if}\;m \leq -9:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(\left|n - m\right| - \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 < -9Initial program 63.3%
associate-/l*63.3%
+-commutative63.3%
associate-/l*63.3%
associate-/l*63.3%
+-commutative63.3%
exp-diff3.3%
sub-neg3.3%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
Simplified63.3%
Taylor expanded in K around 0 100.0%
Simplified100.0%
Taylor expanded in m around inf 88.5%
Taylor expanded in m around inf 98.4%
if -9 < m Initial program 75.3%
associate-/l*75.8%
+-commutative75.8%
associate-/l*75.3%
associate-/l*75.8%
+-commutative75.8%
exp-diff31.4%
sub-neg31.4%
exp-sum26.3%
associate-/r*26.3%
exp-diff33.4%
Simplified75.8%
Taylor expanded in m around 0 67.2%
+-commutative67.2%
unpow267.2%
distribute-rgt-out68.7%
*-commutative68.7%
*-commutative68.7%
Simplified68.7%
Taylor expanded in K around 0 82.4%
Simplified82.4%
Final simplification86.1%
(FPCore (K m n M l)
:precision binary64
(if (<= n 4.5e-81)
(exp (- (fabs (- n m)) (+ l (* (pow m 2.0) 0.25))))
(if (<= n 53.0)
(* (cos (- (* K (/ (+ n m) 2.0)) M)) (exp (- (pow M 2.0))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 4.5e-81) {
tmp = exp((fabs((n - m)) - (l + (pow(m, 2.0) * 0.25))));
} else if (n <= 53.0) {
tmp = cos(((K * ((n + m) / 2.0)) - M)) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 4.5d-81) then
tmp = exp((abs((n - m)) - (l + ((m ** 2.0d0) * 0.25d0))))
else if (n <= 53.0d0) then
tmp = cos(((k * ((n + m) / 2.0d0)) - m_1)) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 4.5e-81) {
tmp = Math.exp((Math.abs((n - m)) - (l + (Math.pow(m, 2.0) * 0.25))));
} else if (n <= 53.0) {
tmp = Math.cos(((K * ((n + m) / 2.0)) - M)) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 4.5e-81: tmp = math.exp((math.fabs((n - m)) - (l + (math.pow(m, 2.0) * 0.25)))) elif n <= 53.0: tmp = math.cos(((K * ((n + m) / 2.0)) - M)) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 4.5e-81) tmp = exp(Float64(abs(Float64(n - m)) - Float64(l + Float64((m ^ 2.0) * 0.25)))); elseif (n <= 53.0) tmp = Float64(cos(Float64(Float64(K * Float64(Float64(n + m) / 2.0)) - M)) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 4.5e-81) tmp = exp((abs((n - m)) - (l + ((m ^ 2.0) * 0.25)))); elseif (n <= 53.0) tmp = cos(((K * ((n + m) / 2.0)) - M)) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 4.5e-81], N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(l + N[(N[Power[m, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 53.0], N[(N[Cos[N[(N[(K * N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 4.5 \cdot 10^{-81}:\\
\;\;\;\;e^{\left|n - m\right| - \left(\ell + {m}^{2} \cdot 0.25\right)}\\
\mathbf{elif}\;n \leq 53:\\
\;\;\;\;\cos \left(K \cdot \frac{n + m}{2} - M\right) \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 4.5e-81Initial program 74.3%
associate-/l*74.9%
+-commutative74.9%
associate-/l*74.3%
associate-/l*74.9%
+-commutative74.9%
exp-diff28.3%
sub-neg28.3%
exp-sum23.7%
associate-/r*23.7%
exp-diff30.1%
Simplified74.9%
Taylor expanded in K around 0 95.4%
Simplified95.4%
Taylor expanded in m around inf 65.2%
Taylor expanded in M around 0 64.6%
if 4.5e-81 < n < 53Initial program 81.9%
associate-/l*81.9%
+-commutative81.9%
associate-/l*81.9%
associate-/l*81.9%
+-commutative81.9%
exp-diff48.5%
sub-neg48.5%
exp-sum48.5%
associate-/r*48.5%
exp-diff58.0%
Simplified81.9%
Taylor expanded in m around 0 67.8%
+-commutative67.8%
unpow267.8%
distribute-rgt-out72.6%
*-commutative72.6%
*-commutative72.6%
Simplified72.6%
Taylor expanded in M around inf 60.0%
mul-1-neg60.0%
Simplified60.0%
if 53 < n Initial program 63.9%
associate-/l*63.9%
+-commutative63.9%
associate-/l*63.9%
associate-/l*63.9%
+-commutative63.9%
exp-diff6.6%
sub-neg6.6%
exp-sum0.0%
associate-/r*0.0%
exp-diff1.6%
Simplified63.9%
Taylor expanded in m around 0 60.7%
+-commutative60.7%
unpow260.7%
distribute-rgt-out62.3%
*-commutative62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in n around inf 62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Final simplification72.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* -0.25 (pow m 2.0))))))
(if (<= m -0.0014)
t_0
(if (<= m 7.2e-259)
(/ (cos M) (exp l))
(if (<= m 0.052)
(* (cos (- (* K (/ (+ n m) 2.0)) M)) (exp (* -0.25 (* n n))))
t_0)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((-0.25 * pow(m, 2.0)));
double tmp;
if (m <= -0.0014) {
tmp = t_0;
} else if (m <= 7.2e-259) {
tmp = cos(M) / exp(l);
} else if (m <= 0.052) {
tmp = cos(((K * ((n + m) / 2.0)) - M)) * exp((-0.25 * (n * n)));
} else {
tmp = t_0;
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
if (m <= (-0.0014d0)) then
tmp = t_0
else if (m <= 7.2d-259) then
tmp = cos(m_1) / exp(l)
else if (m <= 0.052d0) then
tmp = cos(((k * ((n + m) / 2.0d0)) - m_1)) * exp(((-0.25d0) * (n * n)))
else
tmp = t_0
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
double tmp;
if (m <= -0.0014) {
tmp = t_0;
} else if (m <= 7.2e-259) {
tmp = Math.cos(M) / Math.exp(l);
} else if (m <= 0.052) {
tmp = Math.cos(((K * ((n + m) / 2.0)) - M)) * Math.exp((-0.25 * (n * n)));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) tmp = 0 if m <= -0.0014: tmp = t_0 elif m <= 7.2e-259: tmp = math.cos(M) / math.exp(l) elif m <= 0.052: tmp = math.cos(((K * ((n + m) / 2.0)) - M)) * math.exp((-0.25 * (n * n))) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))) tmp = 0.0 if (m <= -0.0014) tmp = t_0; elseif (m <= 7.2e-259) tmp = Float64(cos(M) / exp(l)); elseif (m <= 0.052) tmp = Float64(cos(Float64(Float64(K * Float64(Float64(n + m) / 2.0)) - M)) * exp(Float64(-0.25 * Float64(n * n)))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp((-0.25 * (m ^ 2.0))); tmp = 0.0; if (m <= -0.0014) tmp = t_0; elseif (m <= 7.2e-259) tmp = cos(M) / exp(l); elseif (m <= 0.052) tmp = cos(((K * ((n + m) / 2.0)) - M)) * exp((-0.25 * (n * n))); else tmp = t_0; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -0.0014], t$95$0, If[LessEqual[m, 7.2e-259], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 0.052], N[(N[Cos[N[(N[(K * N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{if}\;m \leq -0.0014:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq 7.2 \cdot 10^{-259}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{elif}\;m \leq 0.052:\\
\;\;\;\;\cos \left(K \cdot \frac{n + m}{2} - M\right) \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if m < -0.00139999999999999999 or 0.0519999999999999976 < m Initial program 62.6%
associate-/l*63.4%
+-commutative63.4%
associate-/l*62.6%
associate-/l*63.4%
+-commutative63.4%
exp-diff4.9%
sub-neg4.9%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.8%
Simplified63.4%
Taylor expanded in K around 0 100.0%
Simplified100.0%
Taylor expanded in m around inf 84.8%
Taylor expanded in m around inf 98.4%
if -0.00139999999999999999 < m < 7.1999999999999996e-259Initial program 81.4%
associate-/l*81.4%
+-commutative81.4%
associate-/l*81.4%
associate-/l*81.4%
+-commutative81.4%
exp-diff42.9%
sub-neg42.9%
exp-sum37.8%
associate-/r*37.8%
exp-diff49.3%
Simplified81.4%
Taylor expanded in m around 0 81.4%
+-commutative81.4%
unpow281.4%
distribute-rgt-out81.4%
*-commutative81.4%
*-commutative81.4%
Simplified81.4%
Taylor expanded in l around inf 44.5%
mul-1-neg44.5%
Simplified44.5%
exp-neg44.5%
Applied egg-rr44.5%
Taylor expanded in K around 0 44.9%
cos-neg44.9%
Simplified44.9%
if 7.1999999999999996e-259 < m < 0.0519999999999999976Initial program 81.9%
associate-/l*81.9%
+-commutative81.9%
associate-/l*81.9%
associate-/l*81.9%
+-commutative81.9%
exp-diff43.7%
sub-neg43.7%
exp-sum40.1%
associate-/r*40.1%
exp-diff47.3%
Simplified81.9%
Taylor expanded in m around 0 81.9%
+-commutative81.9%
unpow281.9%
distribute-rgt-out81.9%
*-commutative81.9%
*-commutative81.9%
Simplified81.9%
Taylor expanded in n around inf 41.9%
*-commutative41.9%
Simplified41.9%
unpow241.9%
Applied egg-rr41.9%
Final simplification70.0%
(FPCore (K m n M l) :precision binary64 (if (<= n 54.0) (exp (- (fabs (- n m)) (+ l (* (pow m 2.0) 0.25)))) (* (cos M) (exp (* -0.25 (pow n 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 54.0) {
tmp = exp((fabs((n - m)) - (l + (pow(m, 2.0) * 0.25))));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 54.0d0) then
tmp = exp((abs((n - m)) - (l + ((m ** 2.0d0) * 0.25d0))))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 54.0) {
tmp = Math.exp((Math.abs((n - m)) - (l + (Math.pow(m, 2.0) * 0.25))));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 54.0: tmp = math.exp((math.fabs((n - m)) - (l + (math.pow(m, 2.0) * 0.25)))) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 54.0) tmp = exp(Float64(abs(Float64(n - m)) - Float64(l + Float64((m ^ 2.0) * 0.25)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 54.0) tmp = exp((abs((n - m)) - (l + ((m ^ 2.0) * 0.25)))); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 54.0], N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(l + N[(N[Power[m, 2.0], $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 54:\\
\;\;\;\;e^{\left|n - m\right| - \left(\ell + {m}^{2} \cdot 0.25\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 54Initial program 75.1%
associate-/l*75.6%
+-commutative75.6%
associate-/l*75.1%
associate-/l*75.6%
+-commutative75.6%
exp-diff30.5%
sub-neg30.5%
exp-sum26.4%
associate-/r*26.4%
exp-diff33.1%
Simplified75.6%
Taylor expanded in K around 0 95.4%
Simplified95.4%
Taylor expanded in m around inf 63.8%
Taylor expanded in M around 0 63.3%
if 54 < n Initial program 63.9%
associate-/l*63.9%
+-commutative63.9%
associate-/l*63.9%
associate-/l*63.9%
+-commutative63.9%
exp-diff6.6%
sub-neg6.6%
exp-sum0.0%
associate-/r*0.0%
exp-diff1.6%
Simplified63.9%
Taylor expanded in m around 0 60.7%
+-commutative60.7%
unpow260.7%
distribute-rgt-out62.3%
*-commutative62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in n around inf 62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Final simplification71.6%
(FPCore (K m n M l) :precision binary64 (if (<= n 54.0) (* (cos M) (exp (* -0.25 (pow m 2.0)))) (* (cos M) (exp (* -0.25 (pow n 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 54.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 54.0d0) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 54.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 54.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 54.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 54.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 54.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 54:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 54Initial program 75.1%
associate-/l*75.6%
+-commutative75.6%
associate-/l*75.1%
associate-/l*75.6%
+-commutative75.6%
exp-diff30.5%
sub-neg30.5%
exp-sum26.4%
associate-/r*26.4%
exp-diff33.1%
Simplified75.6%
Taylor expanded in K around 0 95.4%
Simplified95.4%
Taylor expanded in m around inf 63.8%
Taylor expanded in m around inf 54.6%
if 54 < n Initial program 63.9%
associate-/l*63.9%
+-commutative63.9%
associate-/l*63.9%
associate-/l*63.9%
+-commutative63.9%
exp-diff6.6%
sub-neg6.6%
exp-sum0.0%
associate-/r*0.0%
exp-diff1.6%
Simplified63.9%
Taylor expanded in m around 0 60.7%
+-commutative60.7%
unpow260.7%
distribute-rgt-out62.3%
*-commutative62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in n around inf 62.3%
*-commutative62.3%
Simplified62.3%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Final simplification65.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- (* K (/ (+ n m) 2.0)) M)))
(t_1 (* t_0 (exp (* -0.25 (* n n))))))
(if (<= l -7.8e+253)
(/ (cos (- (* 0.5 (* n K)) M)) (exp l))
(if (<= l -4.3e+186)
t_1
(if (<= l -2.4e+137)
(*
t_0
(+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0))))
(if (<= l -16200000000.0)
(* t_0 (exp (* m (- M (* n 0.5)))))
(if (<= l 0.00125) t_1 (/ (cos M) (exp l)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(((K * ((n + m) / 2.0)) - M));
double t_1 = t_0 * exp((-0.25 * (n * n)));
double tmp;
if (l <= -7.8e+253) {
tmp = cos(((0.5 * (n * K)) - M)) / exp(l);
} else if (l <= -4.3e+186) {
tmp = t_1;
} else if (l <= -2.4e+137) {
tmp = t_0 * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
} else if (l <= -16200000000.0) {
tmp = t_0 * exp((m * (M - (n * 0.5))));
} else if (l <= 0.00125) {
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(((k * ((n + m) / 2.0d0)) - m_1))
t_1 = t_0 * exp(((-0.25d0) * (n * n)))
if (l <= (-7.8d+253)) then
tmp = cos(((0.5d0 * (n * k)) - m_1)) / exp(l)
else if (l <= (-4.3d+186)) then
tmp = t_1
else if (l <= (-2.4d+137)) then
tmp = t_0 * (1.0d0 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0))))
else if (l <= (-16200000000.0d0)) then
tmp = t_0 * exp((m * (m_1 - (n * 0.5d0))))
else if (l <= 0.00125d0) 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(((K * ((n + m) / 2.0)) - M));
double t_1 = t_0 * Math.exp((-0.25 * (n * n)));
double tmp;
if (l <= -7.8e+253) {
tmp = Math.cos(((0.5 * (n * K)) - M)) / Math.exp(l);
} else if (l <= -4.3e+186) {
tmp = t_1;
} else if (l <= -2.4e+137) {
tmp = t_0 * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
} else if (l <= -16200000000.0) {
tmp = t_0 * Math.exp((m * (M - (n * 0.5))));
} else if (l <= 0.00125) {
tmp = t_1;
} else {
tmp = Math.cos(M) / Math.exp(l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(((K * ((n + m) / 2.0)) - M)) t_1 = t_0 * math.exp((-0.25 * (n * n))) tmp = 0 if l <= -7.8e+253: tmp = math.cos(((0.5 * (n * K)) - M)) / math.exp(l) elif l <= -4.3e+186: tmp = t_1 elif l <= -2.4e+137: tmp = t_0 * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))) elif l <= -16200000000.0: tmp = t_0 * math.exp((m * (M - (n * 0.5)))) elif l <= 0.00125: tmp = t_1 else: tmp = math.cos(M) / math.exp(l) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(Float64(K * Float64(Float64(n + m) / 2.0)) - M)) t_1 = Float64(t_0 * exp(Float64(-0.25 * Float64(n * n)))) tmp = 0.0 if (l <= -7.8e+253) tmp = Float64(cos(Float64(Float64(0.5 * Float64(n * K)) - M)) / exp(l)); elseif (l <= -4.3e+186) tmp = t_1; elseif (l <= -2.4e+137) tmp = Float64(t_0 * Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0)))); elseif (l <= -16200000000.0) tmp = Float64(t_0 * exp(Float64(m * Float64(M - Float64(n * 0.5))))); elseif (l <= 0.00125) tmp = t_1; else tmp = Float64(cos(M) / exp(l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(((K * ((n + m) / 2.0)) - M)); t_1 = t_0 * exp((-0.25 * (n * n))); tmp = 0.0; if (l <= -7.8e+253) tmp = cos(((0.5 * (n * K)) - M)) / exp(l); elseif (l <= -4.3e+186) tmp = t_1; elseif (l <= -2.4e+137) tmp = t_0 * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))); elseif (l <= -16200000000.0) tmp = t_0 * exp((m * (M - (n * 0.5)))); elseif (l <= 0.00125) 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[N[(N[(K * N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -7.8e+253], N[(N[Cos[N[(N[(0.5 * N[(n * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -4.3e+186], t$95$1, If[LessEqual[l, -2.4e+137], N[(t$95$0 * N[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -16200000000.0], N[(t$95$0 * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.00125], t$95$1, N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot \frac{n + m}{2} - M\right)\\
t_1 := t\_0 \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{if}\;\ell \leq -7.8 \cdot 10^{+253}:\\
\;\;\;\;\frac{\cos \left(0.5 \cdot \left(n \cdot K\right) - M\right)}{e^{\ell}}\\
\mathbf{elif}\;\ell \leq -4.3 \cdot 10^{+186}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;\ell \leq -2.4 \cdot 10^{+137}:\\
\;\;\;\;t\_0 \cdot \left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)\right)\\
\mathbf{elif}\;\ell \leq -16200000000:\\
\;\;\;\;t\_0 \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{elif}\;\ell \leq 0.00125:\\
\;\;\;\;t\_1\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\end{array}
\end{array}
if l < -7.8000000000000003e253Initial program 58.8%
associate-/l*58.8%
+-commutative58.8%
associate-/l*58.8%
associate-/l*58.8%
+-commutative58.8%
exp-diff17.6%
sub-neg17.6%
exp-sum17.6%
associate-/r*17.6%
exp-diff41.2%
Simplified58.8%
Taylor expanded in m around 0 58.8%
+-commutative58.8%
unpow258.8%
distribute-rgt-out58.8%
*-commutative58.8%
*-commutative58.8%
Simplified58.8%
Taylor expanded in l around inf 35.7%
mul-1-neg35.7%
Simplified35.7%
exp-neg35.7%
Applied egg-rr35.7%
Taylor expanded in m around 0 35.9%
if -7.8000000000000003e253 < l < -4.3e186 or -1.62e10 < l < 0.00125000000000000003Initial program 72.8%
associate-/l*73.4%
+-commutative73.4%
associate-/l*72.8%
associate-/l*73.4%
+-commutative73.4%
exp-diff19.6%
sub-neg19.6%
exp-sum19.6%
associate-/r*19.6%
exp-diff21.7%
Simplified73.4%
Taylor expanded in m around 0 55.1%
+-commutative55.1%
unpow255.1%
distribute-rgt-out57.2%
*-commutative57.2%
*-commutative57.2%
Simplified57.2%
Taylor expanded in n around inf 38.6%
*-commutative38.6%
Simplified38.6%
unpow238.6%
Applied egg-rr38.6%
if -4.3e186 < l < -2.39999999999999983e137Initial program 85.7%
associate-/l*85.7%
+-commutative85.7%
associate-/l*85.7%
associate-/l*85.7%
+-commutative85.7%
exp-diff42.9%
sub-neg42.9%
exp-sum42.9%
associate-/r*42.9%
exp-diff71.4%
Simplified85.7%
Taylor expanded in m around 0 85.7%
+-commutative85.7%
unpow285.7%
distribute-rgt-out85.7%
*-commutative85.7%
*-commutative85.7%
Simplified85.7%
Taylor expanded in l around inf 57.6%
mul-1-neg57.6%
Simplified57.6%
Taylor expanded in l around 0 57.6%
if -2.39999999999999983e137 < l < -1.62e10Initial program 72.7%
associate-/l*72.7%
+-commutative72.7%
associate-/l*72.7%
associate-/l*72.7%
+-commutative72.7%
exp-diff9.1%
sub-neg9.1%
exp-sum9.1%
associate-/r*9.1%
exp-diff31.8%
Simplified72.7%
Taylor expanded in m around 0 68.3%
+-commutative68.3%
unpow268.3%
distribute-rgt-out68.3%
*-commutative68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in m around inf 23.8%
if 0.00125000000000000003 < l Initial program 73.8%
associate-/l*73.8%
+-commutative73.8%
associate-/l*73.8%
associate-/l*73.8%
+-commutative73.8%
exp-diff41.5%
sub-neg41.5%
exp-sum23.1%
associate-/r*23.1%
exp-diff23.1%
Simplified73.8%
Taylor expanded in m around 0 57.1%
+-commutative57.1%
unpow257.1%
distribute-rgt-out61.7%
*-commutative61.7%
*-commutative61.7%
Simplified61.7%
Taylor expanded in l around inf 67.9%
mul-1-neg67.9%
Simplified67.9%
exp-neg67.9%
Applied egg-rr67.9%
Taylor expanded in K around 0 94.0%
cos-neg94.0%
Simplified94.0%
Final simplification51.7%
(FPCore (K m n M l)
:precision binary64
(if (<= l -3.8e+253)
(/ (cos (- (* 0.5 (* n K)) M)) (exp l))
(if (<= l 0.00195)
(* (cos (- (* K (/ (+ n m) 2.0)) M)) (exp (* -0.25 (* n n))))
(/ (cos M) (exp l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -3.8e+253) {
tmp = cos(((0.5 * (n * K)) - M)) / exp(l);
} else if (l <= 0.00195) {
tmp = cos(((K * ((n + m) / 2.0)) - M)) * exp((-0.25 * (n * n)));
} else {
tmp = cos(M) / exp(l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= (-3.8d+253)) then
tmp = cos(((0.5d0 * (n * k)) - m_1)) / exp(l)
else if (l <= 0.00195d0) then
tmp = cos(((k * ((n + m) / 2.0d0)) - m_1)) * exp(((-0.25d0) * (n * n)))
else
tmp = cos(m_1) / exp(l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -3.8e+253) {
tmp = Math.cos(((0.5 * (n * K)) - M)) / Math.exp(l);
} else if (l <= 0.00195) {
tmp = Math.cos(((K * ((n + m) / 2.0)) - M)) * Math.exp((-0.25 * (n * n)));
} else {
tmp = Math.cos(M) / Math.exp(l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -3.8e+253: tmp = math.cos(((0.5 * (n * K)) - M)) / math.exp(l) elif l <= 0.00195: tmp = math.cos(((K * ((n + m) / 2.0)) - M)) * math.exp((-0.25 * (n * n))) else: tmp = math.cos(M) / math.exp(l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -3.8e+253) tmp = Float64(cos(Float64(Float64(0.5 * Float64(n * K)) - M)) / exp(l)); elseif (l <= 0.00195) tmp = Float64(cos(Float64(Float64(K * Float64(Float64(n + m) / 2.0)) - M)) * exp(Float64(-0.25 * Float64(n * n)))); else tmp = Float64(cos(M) / exp(l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= -3.8e+253) tmp = cos(((0.5 * (n * K)) - M)) / exp(l); elseif (l <= 0.00195) tmp = cos(((K * ((n + m) / 2.0)) - M)) * exp((-0.25 * (n * n))); else tmp = cos(M) / exp(l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -3.8e+253], N[(N[Cos[N[(N[(0.5 * N[(n * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 0.00195], N[(N[Cos[N[(N[(K * N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -3.8 \cdot 10^{+253}:\\
\;\;\;\;\frac{\cos \left(0.5 \cdot \left(n \cdot K\right) - M\right)}{e^{\ell}}\\
\mathbf{elif}\;\ell \leq 0.00195:\\
\;\;\;\;\cos \left(K \cdot \frac{n + m}{2} - M\right) \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\end{array}
\end{array}
if l < -3.79999999999999989e253Initial program 58.8%
associate-/l*58.8%
+-commutative58.8%
associate-/l*58.8%
associate-/l*58.8%
+-commutative58.8%
exp-diff17.6%
sub-neg17.6%
exp-sum17.6%
associate-/r*17.6%
exp-diff41.2%
Simplified58.8%
Taylor expanded in m around 0 58.8%
+-commutative58.8%
unpow258.8%
distribute-rgt-out58.8%
*-commutative58.8%
*-commutative58.8%
Simplified58.8%
Taylor expanded in l around inf 35.7%
mul-1-neg35.7%
Simplified35.7%
exp-neg35.7%
Applied egg-rr35.7%
Taylor expanded in m around 0 35.9%
if -3.79999999999999989e253 < l < 0.0019499999999999999Initial program 73.3%
associate-/l*73.8%
+-commutative73.8%
associate-/l*73.3%
associate-/l*73.8%
+-commutative73.8%
exp-diff19.2%
sub-neg19.2%
exp-sum19.2%
associate-/r*19.2%
exp-diff25.0%
Simplified73.8%
Taylor expanded in m around 0 58.0%
+-commutative58.0%
unpow258.0%
distribute-rgt-out59.7%
*-commutative59.7%
*-commutative59.7%
Simplified59.7%
Taylor expanded in n around inf 37.5%
*-commutative37.5%
Simplified37.5%
unpow237.5%
Applied egg-rr37.5%
if 0.0019499999999999999 < l Initial program 73.8%
associate-/l*73.8%
+-commutative73.8%
associate-/l*73.8%
associate-/l*73.8%
+-commutative73.8%
exp-diff41.5%
sub-neg41.5%
exp-sum23.1%
associate-/r*23.1%
exp-diff23.1%
Simplified73.8%
Taylor expanded in m around 0 57.1%
+-commutative57.1%
unpow257.1%
distribute-rgt-out61.7%
*-commutative61.7%
*-commutative61.7%
Simplified61.7%
Taylor expanded in l around inf 67.9%
mul-1-neg67.9%
Simplified67.9%
exp-neg67.9%
Applied egg-rr67.9%
Taylor expanded in K around 0 94.0%
cos-neg94.0%
Simplified94.0%
Final simplification51.8%
(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(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}
\\
\frac{\cos M}{e^{\ell}}
\end{array}
Initial program 72.5%
associate-/l*72.9%
+-commutative72.9%
associate-/l*72.5%
associate-/l*72.9%
+-commutative72.9%
exp-diff24.8%
sub-neg24.8%
exp-sum20.1%
associate-/r*20.1%
exp-diff25.6%
Simplified72.9%
Taylor expanded in m around 0 57.8%
+-commutative57.8%
unpow257.8%
distribute-rgt-out60.2%
*-commutative60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in l around inf 28.3%
mul-1-neg28.3%
Simplified28.3%
exp-neg28.3%
Applied egg-rr28.3%
Taylor expanded in K around 0 35.2%
cos-neg35.2%
Simplified35.2%
Final simplification35.2%
(FPCore (K m n M l) :precision binary64 (* (cos (- (* K (/ (+ n m) 2.0)) M)) (+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(((K * ((n + m) / 2.0)) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(((k * ((n + m) / 2.0d0)) - m_1)) * (1.0d0 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(((K * ((n + m) / 2.0)) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
}
def code(K, m, n, M, l): return math.cos(((K * ((n + m) / 2.0)) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(K * Float64(Float64(n + m) / 2.0)) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(((K * ((n + m) / 2.0)) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(K * N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(K \cdot \frac{n + m}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)\right)
\end{array}
Initial program 72.5%
associate-/l*72.9%
+-commutative72.9%
associate-/l*72.5%
associate-/l*72.9%
+-commutative72.9%
exp-diff24.8%
sub-neg24.8%
exp-sum20.1%
associate-/r*20.1%
exp-diff25.6%
Simplified72.9%
Taylor expanded in m around 0 57.8%
+-commutative57.8%
unpow257.8%
distribute-rgt-out60.2%
*-commutative60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in l around inf 28.3%
mul-1-neg28.3%
Simplified28.3%
Taylor expanded in l around 0 10.7%
Final simplification10.7%
(FPCore (K m n M l) :precision binary64 (* (cos (- (* K (/ (+ n m) 2.0)) M)) (+ 1.0 (* l (+ (* l 0.5) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(((K * ((n + m) / 2.0)) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(((k * ((n + m) / 2.0d0)) - m_1)) * (1.0d0 + (l * ((l * 0.5d0) + (-1.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(((K * ((n + m) / 2.0)) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)));
}
def code(K, m, n, M, l): return math.cos(((K * ((n + m) / 2.0)) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(K * Float64(Float64(n + m) / 2.0)) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(((K * ((n + m) / 2.0)) - M)) * (1.0 + (l * ((l * 0.5) + -1.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(K * N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(K \cdot \frac{n + m}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)\right)
\end{array}
Initial program 72.5%
associate-/l*72.9%
+-commutative72.9%
associate-/l*72.5%
associate-/l*72.9%
+-commutative72.9%
exp-diff24.8%
sub-neg24.8%
exp-sum20.1%
associate-/r*20.1%
exp-diff25.6%
Simplified72.9%
Taylor expanded in m around 0 57.8%
+-commutative57.8%
unpow257.8%
distribute-rgt-out60.2%
*-commutative60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in l around inf 28.3%
mul-1-neg28.3%
Simplified28.3%
Taylor expanded in l around 0 9.8%
Final simplification9.8%
(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 72.5%
associate-/l*72.9%
+-commutative72.9%
associate-/l*72.5%
associate-/l*72.9%
+-commutative72.9%
exp-diff24.8%
sub-neg24.8%
exp-sum20.1%
associate-/r*20.1%
exp-diff25.6%
Simplified72.9%
Taylor expanded in m around 0 57.8%
+-commutative57.8%
unpow257.8%
distribute-rgt-out60.2%
*-commutative60.2%
*-commutative60.2%
Simplified60.2%
Taylor expanded in n around inf 34.2%
*-commutative34.2%
Simplified34.2%
Taylor expanded in n around 0 7.5%
associate-*r*7.5%
Simplified7.5%
Taylor expanded in K around 0 7.9%
cos-neg7.9%
Simplified7.9%
Final simplification7.9%
herbie shell --seed 2024067
(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)))))))