
(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 11 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 (- 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(M) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - 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) / 2.0d0) - 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) / 2.0) - 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) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $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 M \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 74.7%
*-commutative74.7%
associate-*r/74.7%
associate--r-74.7%
+-commutative74.7%
associate-+r-74.7%
unsub-neg74.7%
associate--r+74.7%
+-commutative74.7%
associate--r+74.7%
Simplified74.7%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Final simplification97.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (fabs (- m n)) l)))
(if (<= m -3.6e+16)
(* (cos M) (exp (* (* m m) -0.25)))
(if (or (<= m 2.6e-304) (not (<= m 4.1e-210)))
(* (cos M) (exp (- t_0 (* (* n n) 0.25))))
(* (cos (- (* (+ m n) (/ K 2.0)) M)) (exp (- t_0 (* M M))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n)) - l;
double tmp;
if (m <= -3.6e+16) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else if ((m <= 2.6e-304) || !(m <= 4.1e-210)) {
tmp = cos(M) * exp((t_0 - ((n * n) * 0.25)));
} else {
tmp = cos((((m + n) * (K / 2.0)) - M)) * exp((t_0 - (M * M)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = abs((m - n)) - l
if (m <= (-3.6d+16)) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else if ((m <= 2.6d-304) .or. (.not. (m <= 4.1d-210))) then
tmp = cos(m_1) * exp((t_0 - ((n * n) * 0.25d0)))
else
tmp = cos((((m + n) * (k / 2.0d0)) - m_1)) * exp((t_0 - (m_1 * m_1)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.abs((m - n)) - l;
double tmp;
if (m <= -3.6e+16) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else if ((m <= 2.6e-304) || !(m <= 4.1e-210)) {
tmp = Math.cos(M) * Math.exp((t_0 - ((n * n) * 0.25)));
} else {
tmp = Math.cos((((m + n) * (K / 2.0)) - M)) * Math.exp((t_0 - (M * M)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((m - n)) - l tmp = 0 if m <= -3.6e+16: tmp = math.cos(M) * math.exp(((m * m) * -0.25)) elif (m <= 2.6e-304) or not (m <= 4.1e-210): tmp = math.cos(M) * math.exp((t_0 - ((n * n) * 0.25))) else: tmp = math.cos((((m + n) * (K / 2.0)) - M)) * math.exp((t_0 - (M * M))) return tmp
function code(K, m, n, M, l) t_0 = Float64(abs(Float64(m - n)) - l) tmp = 0.0 if (m <= -3.6e+16) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); elseif ((m <= 2.6e-304) || !(m <= 4.1e-210)) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(Float64(n * n) * 0.25)))); else tmp = Float64(cos(Float64(Float64(Float64(m + n) * Float64(K / 2.0)) - M)) * exp(Float64(t_0 - Float64(M * M)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((m - n)) - l; tmp = 0.0; if (m <= -3.6e+16) tmp = cos(M) * exp(((m * m) * -0.25)); elseif ((m <= 2.6e-304) || ~((m <= 4.1e-210))) tmp = cos(M) * exp((t_0 - ((n * n) * 0.25))); else tmp = cos((((m + n) * (K / 2.0)) - M)) * exp((t_0 - (M * M))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]}, If[LessEqual[m, -3.6e+16], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, 2.6e-304], N[Not[LessEqual[m, 4.1e-210]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(N[(N[(m + n), $MachinePrecision] * N[(K / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
\mathbf{if}\;m \leq -3.6 \cdot 10^{+16}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;m \leq 2.6 \cdot 10^{-304} \lor \neg \left(m \leq 4.1 \cdot 10^{-210}\right):\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(n \cdot n\right) \cdot 0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\left(m + n\right) \cdot \frac{K}{2} - M\right) \cdot e^{t_0 - M \cdot M}\\
\end{array}
\end{array}
if m < -3.6e16Initial program 61.5%
*-commutative61.5%
associate-*r/61.5%
associate--r-61.5%
+-commutative61.5%
associate-+r-61.5%
unsub-neg61.5%
associate--r+61.5%
+-commutative61.5%
associate--r+61.5%
Simplified61.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 98.5%
*-commutative98.5%
unpow298.5%
Simplified98.5%
if -3.6e16 < m < 2.59999999999999997e-304 or 4.09999999999999991e-210 < m Initial program 79.4%
*-commutative79.4%
associate-*r/79.4%
associate--r-79.4%
+-commutative79.4%
associate-+r-79.4%
unsub-neg79.4%
associate--r+79.4%
+-commutative79.4%
associate--r+79.4%
Simplified79.4%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in n around inf 71.0%
*-commutative71.0%
unpow271.0%
Simplified71.0%
if 2.59999999999999997e-304 < m < 4.09999999999999991e-210Initial program 77.3%
*-commutative77.3%
associate-*r/77.3%
associate--r-77.3%
+-commutative77.3%
associate-+r-77.3%
unsub-neg77.3%
associate--r+77.3%
+-commutative77.3%
associate--r+77.3%
Simplified77.3%
Taylor expanded in M around inf 77.3%
unpow273.1%
Simplified77.3%
Final simplification78.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- m n))))
(if (<= m -3.6e+16)
(* (cos M) (exp (* (* m m) -0.25)))
(if (or (<= m 4.5e-304) (not (<= m 4.8e-210)))
(* (cos M) (exp (- (- t_0 l) (* (* n n) 0.25))))
(* (cos (- (/ K (/ 2.0 (+ m n))) M)) (exp (- t_0 (+ l (* M M)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n));
double tmp;
if (m <= -3.6e+16) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else if ((m <= 4.5e-304) || !(m <= 4.8e-210)) {
tmp = cos(M) * exp(((t_0 - l) - ((n * n) * 0.25)));
} else {
tmp = cos(((K / (2.0 / (m + n))) - M)) * exp((t_0 - (l + (M * M))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = abs((m - n))
if (m <= (-3.6d+16)) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else if ((m <= 4.5d-304) .or. (.not. (m <= 4.8d-210))) then
tmp = cos(m_1) * exp(((t_0 - l) - ((n * n) * 0.25d0)))
else
tmp = cos(((k / (2.0d0 / (m + n))) - m_1)) * exp((t_0 - (l + (m_1 * m_1))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.abs((m - n));
double tmp;
if (m <= -3.6e+16) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else if ((m <= 4.5e-304) || !(m <= 4.8e-210)) {
tmp = Math.cos(M) * Math.exp(((t_0 - l) - ((n * n) * 0.25)));
} else {
tmp = Math.cos(((K / (2.0 / (m + n))) - M)) * Math.exp((t_0 - (l + (M * M))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((m - n)) tmp = 0 if m <= -3.6e+16: tmp = math.cos(M) * math.exp(((m * m) * -0.25)) elif (m <= 4.5e-304) or not (m <= 4.8e-210): tmp = math.cos(M) * math.exp(((t_0 - l) - ((n * n) * 0.25))) else: tmp = math.cos(((K / (2.0 / (m + n))) - M)) * math.exp((t_0 - (l + (M * M)))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(m - n)) tmp = 0.0 if (m <= -3.6e+16) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); elseif ((m <= 4.5e-304) || !(m <= 4.8e-210)) tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) - Float64(Float64(n * n) * 0.25)))); else tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / Float64(m + n))) - M)) * exp(Float64(t_0 - Float64(l + Float64(M * M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((m - n)); tmp = 0.0; if (m <= -3.6e+16) tmp = cos(M) * exp(((m * m) * -0.25)); elseif ((m <= 4.5e-304) || ~((m <= 4.8e-210))) tmp = cos(M) * exp(((t_0 - l) - ((n * n) * 0.25))); else tmp = cos(((K / (2.0 / (m + n))) - M)) * exp((t_0 - (l + (M * M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[m, -3.6e+16], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[m, 4.5e-304], N[Not[LessEqual[m, 4.8e-210]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(N[(K / N[(2.0 / N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(l + N[(M * M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right|\\
\mathbf{if}\;m \leq -3.6 \cdot 10^{+16}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;m \leq 4.5 \cdot 10^{-304} \lor \neg \left(m \leq 4.8 \cdot 10^{-210}\right):\\
\;\;\;\;\cos M \cdot e^{\left(t_0 - \ell\right) - \left(n \cdot n\right) \cdot 0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{m + n}} - M\right) \cdot e^{t_0 - \left(\ell + M \cdot M\right)}\\
\end{array}
\end{array}
if m < -3.6e16Initial program 61.5%
*-commutative61.5%
associate-*r/61.5%
associate--r-61.5%
+-commutative61.5%
associate-+r-61.5%
unsub-neg61.5%
associate--r+61.5%
+-commutative61.5%
associate--r+61.5%
Simplified61.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 98.5%
*-commutative98.5%
unpow298.5%
Simplified98.5%
if -3.6e16 < m < 4.4999999999999998e-304 or 4.80000000000000008e-210 < m Initial program 79.4%
*-commutative79.4%
associate-*r/79.4%
associate--r-79.4%
+-commutative79.4%
associate-+r-79.4%
unsub-neg79.4%
associate--r+79.4%
+-commutative79.4%
associate--r+79.4%
Simplified79.4%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in n around inf 71.0%
*-commutative71.0%
unpow271.0%
Simplified71.0%
if 4.4999999999999998e-304 < m < 4.80000000000000008e-210Initial program 77.3%
associate-/l*72.8%
associate--r-72.8%
Simplified72.8%
Taylor expanded in M around inf 72.8%
unpow273.1%
Simplified72.8%
Final simplification78.1%
(FPCore (K m n M l)
:precision binary64
(if (<= n -3.2e-115)
(* (cos M) (exp (* (* m m) -0.25)))
(if (<= n 60.0)
(* (cos M) (exp (- (- (fabs (- m n)) l) (* M M))))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -3.2e-115) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else if (n <= 60.0) {
tmp = cos(M) * exp(((fabs((m - n)) - l) - (M * M)));
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= (-3.2d-115)) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else if (n <= 60.0d0) then
tmp = cos(m_1) * exp(((abs((m - n)) - l) - (m_1 * m_1)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -3.2e-115) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else if (n <= 60.0) {
tmp = Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - (M * M)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -3.2e-115: tmp = math.cos(M) * math.exp(((m * m) * -0.25)) elif n <= 60.0: tmp = math.cos(M) * math.exp(((math.fabs((m - n)) - l) - (M * M))) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -3.2e-115) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); elseif (n <= 60.0) tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(M * M)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= -3.2e-115) tmp = cos(M) * exp(((m * m) * -0.25)); elseif (n <= 60.0) tmp = cos(M) * exp(((abs((m - n)) - l) - (M * M))); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -3.2e-115], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 60.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -3.2 \cdot 10^{-115}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;n \leq 60:\\
\;\;\;\;\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - M \cdot M}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < -3.2e-115Initial program 66.1%
*-commutative66.1%
associate-*r/66.1%
associate--r-66.1%
+-commutative66.1%
associate-+r-66.1%
unsub-neg66.1%
associate--r+66.1%
+-commutative66.1%
associate--r+66.1%
Simplified66.1%
Taylor expanded in K around 0 96.9%
cos-neg96.9%
Simplified96.9%
Taylor expanded in m around inf 59.3%
*-commutative59.3%
unpow259.3%
Simplified59.3%
if -3.2e-115 < n < 60Initial program 83.8%
*-commutative83.8%
associate-*r/83.8%
associate--r-83.8%
+-commutative83.8%
associate-+r-83.8%
unsub-neg83.8%
associate--r+83.8%
+-commutative83.8%
associate--r+83.8%
Simplified83.8%
Taylor expanded in K around 0 96.0%
cos-neg96.0%
Simplified96.0%
Taylor expanded in M around inf 73.0%
unpow273.0%
Simplified73.0%
if 60 < n Initial program 71.2%
*-commutative71.2%
associate-*r/71.2%
associate--r-71.2%
+-commutative71.2%
associate-+r-71.2%
unsub-neg71.2%
associate--r+71.2%
+-commutative71.2%
associate--r+71.2%
Simplified71.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 95.5%
*-commutative69.7%
unpow269.7%
Simplified95.5%
Final simplification74.3%
(FPCore (K m n M l) :precision binary64 (if (<= m -4e+16) (* (cos M) (exp (* (* m m) -0.25))) (* (cos M) (exp (- (- (fabs (- m n)) l) (* (* n n) 0.25))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -4e+16) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else {
tmp = cos(M) * exp(((fabs((m - n)) - l) - ((n * n) * 0.25)));
}
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 <= (-4d+16)) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else
tmp = cos(m_1) * exp(((abs((m - n)) - l) - ((n * n) * 0.25d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -4e+16) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else {
tmp = Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - ((n * n) * 0.25)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -4e+16: tmp = math.cos(M) * math.exp(((m * m) * -0.25)) else: tmp = math.cos(M) * math.exp(((math.fabs((m - n)) - l) - ((n * n) * 0.25))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -4e+16) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); else tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(Float64(n * n) * 0.25)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -4e+16) tmp = cos(M) * exp(((m * m) * -0.25)); else tmp = cos(M) * exp(((abs((m - n)) - l) - ((n * n) * 0.25))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -4e+16], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -4 \cdot 10^{+16}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - \left(n \cdot n\right) \cdot 0.25}\\
\end{array}
\end{array}
if m < -4e16Initial program 61.5%
*-commutative61.5%
associate-*r/61.5%
associate--r-61.5%
+-commutative61.5%
associate-+r-61.5%
unsub-neg61.5%
associate--r+61.5%
+-commutative61.5%
associate--r+61.5%
Simplified61.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 98.5%
*-commutative98.5%
unpow298.5%
Simplified98.5%
if -4e16 < m Initial program 79.2%
*-commutative79.2%
associate-*r/79.2%
associate--r-79.2%
+-commutative79.2%
associate-+r-79.2%
unsub-neg79.2%
associate--r+79.2%
+-commutative79.2%
associate--r+79.2%
Simplified79.2%
Taylor expanded in K around 0 96.4%
cos-neg96.4%
Simplified96.4%
Taylor expanded in n around inf 71.7%
*-commutative71.7%
unpow271.7%
Simplified71.7%
Final simplification78.5%
(FPCore (K m n M l) :precision binary64 (if (or (<= m -6.6e+15) (not (<= m 54.0))) (* (cos M) (exp (* (* m m) -0.25))) (* (cos M) (exp (* M (- M))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -6.6e+15) || !(m <= 54.0)) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else {
tmp = cos(M) * exp((M * -M));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m <= (-6.6d+15)) .or. (.not. (m <= 54.0d0))) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else
tmp = cos(m_1) * exp((m_1 * -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 ((m <= -6.6e+15) || !(m <= 54.0)) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else {
tmp = Math.cos(M) * Math.exp((M * -M));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (m <= -6.6e+15) or not (m <= 54.0): tmp = math.cos(M) * math.exp(((m * m) * -0.25)) else: tmp = math.cos(M) * math.exp((M * -M)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((m <= -6.6e+15) || !(m <= 54.0)) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); else tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((m <= -6.6e+15) || ~((m <= 54.0))) tmp = cos(M) * exp(((m * m) * -0.25)); else tmp = cos(M) * exp((M * -M)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -6.6e+15], N[Not[LessEqual[m, 54.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -6.6 \cdot 10^{+15} \lor \neg \left(m \leq 54\right):\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\end{array}
\end{array}
if m < -6.6e15 or 54 < m Initial program 63.1%
*-commutative63.1%
associate-*r/63.1%
associate--r-63.1%
+-commutative63.1%
associate-+r-63.1%
unsub-neg63.1%
associate--r+63.1%
+-commutative63.1%
associate--r+63.1%
Simplified63.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 99.1%
*-commutative99.1%
unpow299.1%
Simplified99.1%
if -6.6e15 < m < 54Initial program 83.6%
*-commutative83.6%
associate-*r/83.6%
associate--r-83.6%
+-commutative83.6%
associate-+r-83.6%
unsub-neg83.6%
associate--r+83.6%
+-commutative83.6%
associate--r+83.6%
Simplified83.6%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Taylor expanded in M around inf 61.4%
mul-1-neg61.4%
unpow261.4%
distribute-rgt-neg-in61.4%
Simplified61.4%
Final simplification77.8%
(FPCore (K m n M l)
:precision binary64
(if (<= n 7.5e-226)
(* (cos M) (exp (* (* m m) -0.25)))
(if (<= n 53.0)
(* (cos M) (exp (* M (- M))))
(* (cos M) (exp (* -0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 7.5e-226) {
tmp = cos(M) * exp(((m * m) * -0.25));
} else if (n <= 53.0) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 7.5d-226) then
tmp = cos(m_1) * exp(((m * m) * (-0.25d0)))
else if (n <= 53.0d0) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 7.5e-226) {
tmp = Math.cos(M) * Math.exp(((m * m) * -0.25));
} else if (n <= 53.0) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 7.5e-226: tmp = math.cos(M) * math.exp(((m * m) * -0.25)) elif n <= 53.0: tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 7.5e-226) tmp = Float64(cos(M) * exp(Float64(Float64(m * m) * -0.25))); elseif (n <= 53.0) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 7.5e-226) tmp = cos(M) * exp(((m * m) * -0.25)); elseif (n <= 53.0) tmp = cos(M) * exp((M * -M)); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 7.5e-226], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m * m), $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 53.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 7.5 \cdot 10^{-226}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot m\right) \cdot -0.25}\\
\mathbf{elif}\;n \leq 53:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 7.50000000000000044e-226Initial program 73.1%
*-commutative73.1%
associate-*r/73.1%
associate--r-73.1%
+-commutative73.1%
associate-+r-73.1%
unsub-neg73.1%
associate--r+73.1%
+-commutative73.1%
associate--r+73.1%
Simplified73.1%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in m around inf 59.4%
*-commutative59.4%
unpow259.4%
Simplified59.4%
if 7.50000000000000044e-226 < n < 53Initial program 85.8%
*-commutative85.8%
associate-*r/85.8%
associate--r-85.8%
+-commutative85.8%
associate-+r-85.8%
unsub-neg85.8%
associate--r+85.8%
+-commutative85.8%
associate--r+85.8%
Simplified85.8%
Taylor expanded in K around 0 92.9%
cos-neg92.9%
Simplified92.9%
Taylor expanded in M around inf 63.6%
mul-1-neg63.6%
unpow263.6%
distribute-rgt-neg-in63.6%
Simplified63.6%
if 53 < n Initial program 71.2%
*-commutative71.2%
associate-*r/71.2%
associate--r-71.2%
+-commutative71.2%
associate-+r-71.2%
unsub-neg71.2%
associate--r+71.2%
+-commutative71.2%
associate--r+71.2%
Simplified71.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 95.5%
*-commutative69.7%
unpow269.7%
Simplified95.5%
Final simplification69.4%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -1.4e-33) (not (<= M 6.5e-13))) (* (cos M) (exp (* M (- M)))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -1.4e-33) || !(M <= 6.5e-13)) {
tmp = cos(M) * exp((M * -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 ((m_1 <= (-1.4d-33)) .or. (.not. (m_1 <= 6.5d-13))) then
tmp = cos(m_1) * exp((m_1 * -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 ((M <= -1.4e-33) || !(M <= 6.5e-13)) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -1.4e-33) or not (M <= 6.5e-13): tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -1.4e-33) || !(M <= 6.5e-13)) tmp = Float64(cos(M) * exp(Float64(M * Float64(-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 ((M <= -1.4e-33) || ~((M <= 6.5e-13))) tmp = cos(M) * exp((M * -M)); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -1.4e-33], N[Not[LessEqual[M, 6.5e-13]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1.4 \cdot 10^{-33} \lor \neg \left(M \leq 6.5 \cdot 10^{-13}\right):\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if M < -1.4e-33 or 6.49999999999999957e-13 < M Initial program 73.7%
*-commutative73.7%
associate-*r/73.7%
associate--r-73.7%
+-commutative73.7%
associate-+r-73.7%
unsub-neg73.7%
associate--r+73.7%
+-commutative73.7%
associate--r+73.7%
Simplified73.7%
Taylor expanded in K around 0 97.7%
cos-neg97.7%
Simplified97.7%
Taylor expanded in M around inf 92.4%
mul-1-neg92.4%
unpow292.4%
distribute-rgt-neg-in92.4%
Simplified92.4%
if -1.4e-33 < M < 6.49999999999999957e-13Initial program 75.7%
*-commutative75.7%
associate-*r/75.7%
associate--r-75.7%
+-commutative75.7%
associate-+r-75.7%
unsub-neg75.7%
associate--r+75.7%
+-commutative75.7%
associate--r+75.7%
Simplified75.7%
Taylor expanded in l around inf 43.8%
neg-mul-143.8%
Simplified43.8%
Taylor expanded in K around 0 49.7%
cos-neg49.7%
Simplified49.7%
Final simplification71.2%
(FPCore (K m n M l) :precision binary64 (if (or (<= K -8.1e-150) (not (<= K 1.25e-79))) (* (cos M) (exp (- l))) (* -0.5 (* n (* K (sin (- (* 0.5 (* m K)) M)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((K <= -8.1e-150) || !(K <= 1.25e-79)) {
tmp = cos(M) * exp(-l);
} else {
tmp = -0.5 * (n * (K * sin(((0.5 * (m * K)) - 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 ((k <= (-8.1d-150)) .or. (.not. (k <= 1.25d-79))) then
tmp = cos(m_1) * exp(-l)
else
tmp = (-0.5d0) * (n * (k * sin(((0.5d0 * (m * k)) - 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 ((K <= -8.1e-150) || !(K <= 1.25e-79)) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = -0.5 * (n * (K * Math.sin(((0.5 * (m * K)) - M))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (K <= -8.1e-150) or not (K <= 1.25e-79): tmp = math.cos(M) * math.exp(-l) else: tmp = -0.5 * (n * (K * math.sin(((0.5 * (m * K)) - M)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((K <= -8.1e-150) || !(K <= 1.25e-79)) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = Float64(-0.5 * Float64(n * Float64(K * sin(Float64(Float64(0.5 * Float64(m * K)) - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((K <= -8.1e-150) || ~((K <= 1.25e-79))) tmp = cos(M) * exp(-l); else tmp = -0.5 * (n * (K * sin(((0.5 * (m * K)) - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[K, -8.1e-150], N[Not[LessEqual[K, 1.25e-79]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(-0.5 * N[(n * N[(K * N[Sin[N[(N[(0.5 * N[(m * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq -8.1 \cdot 10^{-150} \lor \neg \left(K \leq 1.25 \cdot 10^{-79}\right):\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;-0.5 \cdot \left(n \cdot \left(K \cdot \sin \left(0.5 \cdot \left(m \cdot K\right) - M\right)\right)\right)\\
\end{array}
\end{array}
if K < -8.1000000000000004e-150 or 1.25e-79 < K Initial program 64.4%
*-commutative64.4%
associate-*r/64.4%
associate--r-64.4%
+-commutative64.4%
associate-+r-64.4%
unsub-neg64.4%
associate--r+64.4%
+-commutative64.4%
associate--r+64.4%
Simplified64.4%
Taylor expanded in l around inf 34.1%
neg-mul-134.1%
Simplified34.1%
Taylor expanded in K around 0 41.8%
cos-neg41.8%
Simplified41.8%
if -8.1000000000000004e-150 < K < 1.25e-79Initial program 100.0%
*-commutative100.0%
associate-*r/100.0%
associate--r-100.0%
+-commutative100.0%
associate-+r-100.0%
unsub-neg100.0%
associate--r+100.0%
+-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in n around inf 55.4%
*-commutative55.4%
unpow255.4%
Simplified55.4%
Taylor expanded in n around 0 8.3%
Taylor expanded in K around 0 8.3%
neg-mul-18.4%
Simplified8.3%
Taylor expanded in n around inf 48.2%
Final simplification43.7%
(FPCore (K m n M l) :precision binary64 (if (or (<= l -5.9e-117) (not (<= l 5.3e-157))) (* -0.5 (* n (* K (sin (- (* 0.5 (* m K)) M))))) (cos (- M))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((l <= -5.9e-117) || !(l <= 5.3e-157)) {
tmp = -0.5 * (n * (K * sin(((0.5 * (m * K)) - M))));
} else {
tmp = cos(-M);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((l <= (-5.9d-117)) .or. (.not. (l <= 5.3d-157))) then
tmp = (-0.5d0) * (n * (k * sin(((0.5d0 * (m * k)) - m_1))))
else
tmp = cos(-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 ((l <= -5.9e-117) || !(l <= 5.3e-157)) {
tmp = -0.5 * (n * (K * Math.sin(((0.5 * (m * K)) - M))));
} else {
tmp = Math.cos(-M);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (l <= -5.9e-117) or not (l <= 5.3e-157): tmp = -0.5 * (n * (K * math.sin(((0.5 * (m * K)) - M)))) else: tmp = math.cos(-M) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((l <= -5.9e-117) || !(l <= 5.3e-157)) tmp = Float64(-0.5 * Float64(n * Float64(K * sin(Float64(Float64(0.5 * Float64(m * K)) - M))))); else tmp = cos(Float64(-M)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((l <= -5.9e-117) || ~((l <= 5.3e-157))) tmp = -0.5 * (n * (K * sin(((0.5 * (m * K)) - M)))); else tmp = cos(-M); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[l, -5.9e-117], N[Not[LessEqual[l, 5.3e-157]], $MachinePrecision]], N[(-0.5 * N[(n * N[(K * N[Sin[N[(N[(0.5 * N[(m * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], N[Cos[(-M)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.9 \cdot 10^{-117} \lor \neg \left(\ell \leq 5.3 \cdot 10^{-157}\right):\\
\;\;\;\;-0.5 \cdot \left(n \cdot \left(K \cdot \sin \left(0.5 \cdot \left(m \cdot K\right) - M\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos \left(-M\right)\\
\end{array}
\end{array}
if l < -5.9000000000000003e-117 or 5.3000000000000002e-157 < l Initial program 77.1%
*-commutative77.1%
associate-*r/77.1%
associate--r-77.1%
+-commutative77.1%
associate-+r-77.1%
unsub-neg77.1%
associate--r+77.1%
+-commutative77.1%
associate--r+77.1%
Simplified77.1%
Taylor expanded in n around inf 34.2%
*-commutative34.2%
unpow234.2%
Simplified34.2%
Taylor expanded in n around 0 5.5%
Taylor expanded in K around 0 5.5%
neg-mul-15.6%
Simplified5.5%
Taylor expanded in n around inf 20.6%
if -5.9000000000000003e-117 < l < 5.3000000000000002e-157Initial program 67.4%
*-commutative67.4%
associate-*r/67.4%
associate--r-67.4%
+-commutative67.4%
associate-+r-67.4%
unsub-neg67.4%
associate--r+67.4%
+-commutative67.4%
associate--r+67.4%
Simplified67.4%
Taylor expanded in n around inf 52.8%
*-commutative52.8%
unpow252.8%
Simplified52.8%
Taylor expanded in n around 0 23.1%
Taylor expanded in K around 0 23.4%
neg-mul-123.4%
Simplified23.4%
Final simplification21.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(Float64(-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 \left(-M\right)
\end{array}
Initial program 74.7%
*-commutative74.7%
associate-*r/74.7%
associate--r-74.7%
+-commutative74.7%
associate-+r-74.7%
unsub-neg74.7%
associate--r+74.7%
+-commutative74.7%
associate--r+74.7%
Simplified74.7%
Taylor expanded in n around inf 38.9%
*-commutative38.9%
unpow238.9%
Simplified38.9%
Taylor expanded in n around 0 9.7%
Taylor expanded in K around 0 10.0%
neg-mul-110.0%
Simplified10.0%
Final simplification10.0%
herbie shell --seed 2023194
(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)))))))