
(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 77.9%
*-commutative77.9%
associate-*r/77.9%
associate--r-77.9%
+-commutative77.9%
associate-+r-77.9%
unsub-neg77.9%
associate--r+77.9%
+-commutative77.9%
associate--r+77.9%
Simplified77.9%
Taylor expanded in K around 0 94.3%
cos-neg94.3%
Simplified94.3%
Final simplification94.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- m n))) (t_1 (- t_0 l)))
(if (<= n 4.2e-257)
(* (cos M) (exp (+ t_1 (* -0.25 (* m m)))))
(if (<= n 5.5e-6)
(* (cos (- (/ K (/ 2.0 (+ m n))) M)) (exp (- t_0 (+ l (* M M)))))
(* (cos M) (exp (- t_1 (* (* n n) 0.25))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n));
double t_1 = t_0 - l;
double tmp;
if (n <= 4.2e-257) {
tmp = cos(M) * exp((t_1 + (-0.25 * (m * m))));
} else if (n <= 5.5e-6) {
tmp = cos(((K / (2.0 / (m + n))) - M)) * exp((t_0 - (l + (M * M))));
} else {
tmp = cos(M) * exp((t_1 - ((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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = abs((m - n))
t_1 = t_0 - l
if (n <= 4.2d-257) then
tmp = cos(m_1) * exp((t_1 + ((-0.25d0) * (m * m))))
else if (n <= 5.5d-6) then
tmp = cos(((k / (2.0d0 / (m + n))) - m_1)) * exp((t_0 - (l + (m_1 * m_1))))
else
tmp = cos(m_1) * exp((t_1 - ((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 t_0 = Math.abs((m - n));
double t_1 = t_0 - l;
double tmp;
if (n <= 4.2e-257) {
tmp = Math.cos(M) * Math.exp((t_1 + (-0.25 * (m * m))));
} else if (n <= 5.5e-6) {
tmp = Math.cos(((K / (2.0 / (m + n))) - M)) * Math.exp((t_0 - (l + (M * M))));
} else {
tmp = Math.cos(M) * Math.exp((t_1 - ((n * n) * 0.25)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((m - n)) t_1 = t_0 - l tmp = 0 if n <= 4.2e-257: tmp = math.cos(M) * math.exp((t_1 + (-0.25 * (m * m)))) elif n <= 5.5e-6: tmp = math.cos(((K / (2.0 / (m + n))) - M)) * math.exp((t_0 - (l + (M * M)))) else: tmp = math.cos(M) * math.exp((t_1 - ((n * n) * 0.25))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(m - n)) t_1 = Float64(t_0 - l) tmp = 0.0 if (n <= 4.2e-257) tmp = Float64(cos(M) * exp(Float64(t_1 + Float64(-0.25 * Float64(m * m))))); elseif (n <= 5.5e-6) tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / Float64(m + n))) - M)) * exp(Float64(t_0 - Float64(l + Float64(M * M))))); else tmp = Float64(cos(M) * exp(Float64(t_1 - Float64(Float64(n * n) * 0.25)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((m - n)); t_1 = t_0 - l; tmp = 0.0; if (n <= 4.2e-257) tmp = cos(M) * exp((t_1 + (-0.25 * (m * m)))); elseif (n <= 5.5e-6) tmp = cos(((K / (2.0 / (m + n))) - M)) * exp((t_0 - (l + (M * M)))); else tmp = cos(M) * exp((t_1 - ((n * n) * 0.25))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[(t$95$0 - l), $MachinePrecision]}, If[LessEqual[n, 4.2e-257], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$1 + N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 5.5e-6], 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], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$1 - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right|\\
t_1 := t_0 - \ell\\
\mathbf{if}\;n \leq 4.2 \cdot 10^{-257}:\\
\;\;\;\;\cos M \cdot e^{t_1 + -0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;n \leq 5.5 \cdot 10^{-6}:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{m + n}} - M\right) \cdot e^{t_0 - \left(\ell + M \cdot M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t_1 - \left(n \cdot n\right) \cdot 0.25}\\
\end{array}
\end{array}
if n < 4.2000000000000002e-257Initial program 78.4%
*-commutative78.4%
associate-*r/78.4%
associate--r-78.4%
+-commutative78.4%
associate-+r-78.4%
unsub-neg78.4%
associate--r+78.4%
+-commutative78.4%
associate--r+78.4%
Simplified78.4%
Taylor expanded in m around inf 50.5%
*-commutative50.5%
unpow250.5%
Simplified50.5%
Taylor expanded in K around 0 61.2%
*-commutative61.2%
Simplified61.2%
if 4.2000000000000002e-257 < n < 5.4999999999999999e-6Initial program 77.2%
associate-/l*77.5%
associate--r-77.5%
Simplified77.5%
Taylor expanded in M around inf 62.4%
unpow266.1%
Simplified62.4%
if 5.4999999999999999e-6 < n Initial program 77.6%
*-commutative77.6%
associate-*r/77.6%
associate--r-77.6%
+-commutative77.6%
associate-+r-77.6%
unsub-neg77.6%
associate--r+77.6%
+-commutative77.6%
associate--r+77.6%
Simplified77.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 87.9%
*-commutative87.9%
unpow287.9%
Simplified87.9%
Final simplification66.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (fabs (- m n)) l)))
(if (<= m -1000000.0)
(* (cos M) (exp (* -0.25 (* m m))))
(if (<= m 1.85e-239)
(* (cos M) (exp (- t_0 (* M M))))
(* (cos M) (exp (- t_0 (* (* n n) 0.25))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n)) - l;
double tmp;
if (m <= -1000000.0) {
tmp = cos(M) * exp((-0.25 * (m * m)));
} else if (m <= 1.85e-239) {
tmp = cos(M) * exp((t_0 - (M * M)));
} else {
tmp = cos(M) * exp((t_0 - ((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) :: t_0
real(8) :: tmp
t_0 = abs((m - n)) - l
if (m <= (-1000000.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
else if (m <= 1.85d-239) then
tmp = cos(m_1) * exp((t_0 - (m_1 * m_1)))
else
tmp = cos(m_1) * exp((t_0 - ((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 t_0 = Math.abs((m - n)) - l;
double tmp;
if (m <= -1000000.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
} else if (m <= 1.85e-239) {
tmp = Math.cos(M) * Math.exp((t_0 - (M * M)));
} else {
tmp = Math.cos(M) * Math.exp((t_0 - ((n * n) * 0.25)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((m - n)) - l tmp = 0 if m <= -1000000.0: tmp = math.cos(M) * math.exp((-0.25 * (m * m))) elif m <= 1.85e-239: tmp = math.cos(M) * math.exp((t_0 - (M * M))) else: tmp = math.cos(M) * math.exp((t_0 - ((n * n) * 0.25))) return tmp
function code(K, m, n, M, l) t_0 = Float64(abs(Float64(m - n)) - l) tmp = 0.0 if (m <= -1000000.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m)))); elseif (m <= 1.85e-239) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(M * M)))); else tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(Float64(n * n) * 0.25)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((m - n)) - l; tmp = 0.0; if (m <= -1000000.0) tmp = cos(M) * exp((-0.25 * (m * m))); elseif (m <= 1.85e-239) tmp = cos(M) * exp((t_0 - (M * M))); else tmp = cos(M) * exp((t_0 - ((n * n) * 0.25))); 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, -1000000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.85e-239], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
\mathbf{if}\;m \leq -1000000:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;m \leq 1.85 \cdot 10^{-239}:\\
\;\;\;\;\cos M \cdot e^{t_0 - M \cdot M}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(n \cdot n\right) \cdot 0.25}\\
\end{array}
\end{array}
if m < -1e6Initial program 72.4%
*-commutative72.4%
associate-*r/72.4%
associate--r-72.4%
+-commutative72.4%
associate-+r-72.4%
unsub-neg72.4%
associate--r+72.4%
+-commutative72.4%
associate--r+72.4%
Simplified72.4%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in m around inf 97.4%
*-commutative97.4%
unpow297.4%
Simplified97.4%
if -1e6 < m < 1.85000000000000008e-239Initial program 77.2%
*-commutative77.2%
associate-*r/77.2%
associate--r-77.2%
+-commutative77.2%
associate-+r-77.2%
unsub-neg77.2%
associate--r+77.2%
+-commutative77.2%
associate--r+77.2%
Simplified77.2%
Taylor expanded in K around 0 90.2%
cos-neg90.2%
Simplified90.2%
Taylor expanded in M around inf 63.2%
unpow263.2%
Simplified63.2%
if 1.85000000000000008e-239 < m Initial program 82.4%
*-commutative82.4%
associate-*r/82.4%
associate--r-82.4%
+-commutative82.4%
associate-+r-82.4%
unsub-neg82.4%
associate--r+82.4%
+-commutative82.4%
associate--r+82.4%
Simplified82.4%
Taylor expanded in K around 0 94.1%
cos-neg94.1%
Simplified94.1%
Taylor expanded in n around inf 54.9%
*-commutative54.9%
unpow254.9%
Simplified54.9%
Final simplification69.9%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (fabs (- m n)) l)))
(if (<= n 2.8e-265)
(* (cos M) (exp (+ t_0 (* -0.25 (* m m)))))
(if (<= n 21000000.0)
(* (cos M) (exp (- t_0 (* M M))))
(* (cos M) (exp (- t_0 (* (* n n) 0.25))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n)) - l;
double tmp;
if (n <= 2.8e-265) {
tmp = cos(M) * exp((t_0 + (-0.25 * (m * m))));
} else if (n <= 21000000.0) {
tmp = cos(M) * exp((t_0 - (M * M)));
} else {
tmp = cos(M) * exp((t_0 - ((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) :: t_0
real(8) :: tmp
t_0 = abs((m - n)) - l
if (n <= 2.8d-265) then
tmp = cos(m_1) * exp((t_0 + ((-0.25d0) * (m * m))))
else if (n <= 21000000.0d0) then
tmp = cos(m_1) * exp((t_0 - (m_1 * m_1)))
else
tmp = cos(m_1) * exp((t_0 - ((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 t_0 = Math.abs((m - n)) - l;
double tmp;
if (n <= 2.8e-265) {
tmp = Math.cos(M) * Math.exp((t_0 + (-0.25 * (m * m))));
} else if (n <= 21000000.0) {
tmp = Math.cos(M) * Math.exp((t_0 - (M * M)));
} else {
tmp = Math.cos(M) * Math.exp((t_0 - ((n * n) * 0.25)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((m - n)) - l tmp = 0 if n <= 2.8e-265: tmp = math.cos(M) * math.exp((t_0 + (-0.25 * (m * m)))) elif n <= 21000000.0: tmp = math.cos(M) * math.exp((t_0 - (M * M))) else: tmp = math.cos(M) * math.exp((t_0 - ((n * n) * 0.25))) return tmp
function code(K, m, n, M, l) t_0 = Float64(abs(Float64(m - n)) - l) tmp = 0.0 if (n <= 2.8e-265) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(-0.25 * Float64(m * m))))); elseif (n <= 21000000.0) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(M * M)))); else tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(Float64(n * n) * 0.25)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((m - n)) - l; tmp = 0.0; if (n <= 2.8e-265) tmp = cos(M) * exp((t_0 + (-0.25 * (m * m)))); elseif (n <= 21000000.0) tmp = cos(M) * exp((t_0 - (M * M))); else tmp = cos(M) * exp((t_0 - ((n * n) * 0.25))); 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[n, 2.8e-265], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 21000000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(N[(n * n), $MachinePrecision] * 0.25), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
\mathbf{if}\;n \leq 2.8 \cdot 10^{-265}:\\
\;\;\;\;\cos M \cdot e^{t_0 + -0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;n \leq 21000000:\\
\;\;\;\;\cos M \cdot e^{t_0 - M \cdot M}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(n \cdot n\right) \cdot 0.25}\\
\end{array}
\end{array}
if n < 2.80000000000000023e-265Initial program 78.9%
*-commutative78.9%
associate-*r/78.9%
associate--r-78.9%
+-commutative78.9%
associate-+r-78.9%
unsub-neg78.9%
associate--r+78.9%
+-commutative78.9%
associate--r+78.9%
Simplified78.9%
Taylor expanded in m around inf 50.2%
*-commutative50.2%
unpow250.2%
Simplified50.2%
Taylor expanded in K around 0 61.3%
*-commutative61.3%
Simplified61.3%
if 2.80000000000000023e-265 < n < 2.1e7Initial program 75.4%
*-commutative75.4%
associate-*r/75.4%
associate--r-75.4%
+-commutative75.4%
associate-+r-75.4%
unsub-neg75.4%
associate--r+75.4%
+-commutative75.4%
associate--r+75.4%
Simplified75.4%
Taylor expanded in K around 0 87.6%
cos-neg87.6%
Simplified87.6%
Taylor expanded in M around inf 63.7%
unpow263.7%
Simplified63.7%
if 2.1e7 < n Initial program 78.7%
*-commutative78.7%
associate-*r/78.7%
associate--r-78.7%
+-commutative78.7%
associate-+r-78.7%
unsub-neg78.7%
associate--r+78.7%
+-commutative78.7%
associate--r+78.7%
Simplified78.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 91.6%
*-commutative91.6%
unpow291.6%
Simplified91.6%
Final simplification67.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (fabs (- m n)) l)))
(if (<= m -6800.0)
(* (cos M) (exp (* -0.25 (* m m))))
(if (<= m 3.5e-239)
(* (cos M) (exp (- t_0 (* M M))))
(exp (+ t_0 (* -0.25 (* n n))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n)) - l;
double tmp;
if (m <= -6800.0) {
tmp = cos(M) * exp((-0.25 * (m * m)));
} else if (m <= 3.5e-239) {
tmp = cos(M) * exp((t_0 - (M * M)));
} else {
tmp = exp((t_0 + (-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) :: t_0
real(8) :: tmp
t_0 = abs((m - n)) - l
if (m <= (-6800.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
else if (m <= 3.5d-239) then
tmp = cos(m_1) * exp((t_0 - (m_1 * m_1)))
else
tmp = exp((t_0 + ((-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 t_0 = Math.abs((m - n)) - l;
double tmp;
if (m <= -6800.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
} else if (m <= 3.5e-239) {
tmp = Math.cos(M) * Math.exp((t_0 - (M * M)));
} else {
tmp = Math.exp((t_0 + (-0.25 * (n * n))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((m - n)) - l tmp = 0 if m <= -6800.0: tmp = math.cos(M) * math.exp((-0.25 * (m * m))) elif m <= 3.5e-239: tmp = math.cos(M) * math.exp((t_0 - (M * M))) else: tmp = math.exp((t_0 + (-0.25 * (n * n)))) return tmp
function code(K, m, n, M, l) t_0 = Float64(abs(Float64(m - n)) - l) tmp = 0.0 if (m <= -6800.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m)))); elseif (m <= 3.5e-239) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(M * M)))); else tmp = exp(Float64(t_0 + Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((m - n)) - l; tmp = 0.0; if (m <= -6800.0) tmp = cos(M) * exp((-0.25 * (m * m))); elseif (m <= 3.5e-239) tmp = cos(M) * exp((t_0 - (M * M))); else tmp = exp((t_0 + (-0.25 * (n * n)))); 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, -6800.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 3.5e-239], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(M * M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(t$95$0 + N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
\mathbf{if}\;m \leq -6800:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;m \leq 3.5 \cdot 10^{-239}:\\
\;\;\;\;\cos M \cdot e^{t_0 - M \cdot M}\\
\mathbf{else}:\\
\;\;\;\;e^{t_0 + -0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if m < -6800Initial program 72.4%
*-commutative72.4%
associate-*r/72.4%
associate--r-72.4%
+-commutative72.4%
associate-+r-72.4%
unsub-neg72.4%
associate--r+72.4%
+-commutative72.4%
associate--r+72.4%
Simplified72.4%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in m around inf 97.4%
*-commutative97.4%
unpow297.4%
Simplified97.4%
if -6800 < m < 3.50000000000000005e-239Initial program 77.2%
*-commutative77.2%
associate-*r/77.2%
associate--r-77.2%
+-commutative77.2%
associate-+r-77.2%
unsub-neg77.2%
associate--r+77.2%
+-commutative77.2%
associate--r+77.2%
Simplified77.2%
Taylor expanded in K around 0 90.2%
cos-neg90.2%
Simplified90.2%
Taylor expanded in M around inf 63.2%
unpow263.2%
Simplified63.2%
if 3.50000000000000005e-239 < m Initial program 82.4%
*-commutative82.4%
associate-*r/82.4%
associate--r-82.4%
+-commutative82.4%
associate-+r-82.4%
unsub-neg82.4%
associate--r+82.4%
+-commutative82.4%
associate--r+82.4%
Simplified82.4%
Taylor expanded in K around 0 94.1%
cos-neg94.1%
Simplified94.1%
Taylor expanded in n around inf 54.9%
*-commutative54.9%
unpow254.9%
Simplified54.9%
Taylor expanded in M around 0 54.0%
exp-diff17.4%
sub-neg17.4%
mul-1-neg17.4%
+-commutative17.4%
remove-double-neg17.4%
mul-1-neg17.4%
mul-1-neg17.4%
distribute-neg-in17.4%
exp-diff54.0%
associate--r+54.0%
*-commutative54.0%
unpow254.0%
associate-*r*54.0%
Simplified54.0%
Final simplification69.5%
(FPCore (K m n M l)
:precision binary64
(if (<= n 9.5e-229)
(exp (- (fma -0.25 (* m m) (fabs (- m n))) l))
(if (<= n 55.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 <= 9.5e-229) {
tmp = exp((fma(-0.25, (m * m), fabs((m - n))) - l));
} else if (n <= 55.0) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
return tmp;
}
function code(K, m, n, M, l) tmp = 0.0 if (n <= 9.5e-229) tmp = exp(Float64(fma(-0.25, Float64(m * m), abs(Float64(m - n))) - l)); elseif (n <= 55.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
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 9.5e-229], N[Exp[N[(N[(-0.25 * N[(m * m), $MachinePrecision] + N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision], If[LessEqual[n, 55.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 9.5 \cdot 10^{-229}:\\
\;\;\;\;e^{\mathsf{fma}\left(-0.25, m \cdot m, \left|m - n\right|\right) - \ell}\\
\mathbf{elif}\;n \leq 55:\\
\;\;\;\;\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 < 9.4999999999999997e-229Initial program 79.8%
*-commutative79.8%
associate-*r/79.8%
associate--r-79.8%
+-commutative79.8%
associate-+r-79.8%
unsub-neg79.8%
associate--r+79.8%
+-commutative79.8%
associate--r+79.8%
Simplified79.8%
Taylor expanded in m around inf 53.0%
*-commutative53.0%
unpow253.0%
Simplified53.0%
Taylor expanded in K around 0 63.1%
*-commutative63.1%
Simplified63.1%
Taylor expanded in M around 0 61.8%
exp-diff50.8%
rem-log-exp50.8%
rem-log-exp50.8%
exp-diff50.8%
rem-log-exp58.5%
fma-def58.5%
unpow258.5%
rem-log-exp61.8%
Simplified61.8%
if 9.4999999999999997e-229 < n < 55Initial program 73.2%
*-commutative73.2%
associate-*r/73.2%
associate--r-73.2%
+-commutative73.2%
associate-+r-73.2%
unsub-neg73.2%
associate--r+73.2%
+-commutative73.2%
associate--r+73.2%
Simplified73.2%
Taylor expanded in K around 0 87.4%
cos-neg87.4%
Simplified87.4%
Taylor expanded in M around inf 52.7%
mul-1-neg52.7%
unpow252.7%
distribute-rgt-neg-in52.7%
Simplified52.7%
if 55 < n 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 K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 95.9%
*-commutative95.9%
unpow295.9%
Simplified95.9%
Final simplification66.3%
(FPCore (K m n M l) :precision binary64 (if (<= m -1.55e+25) (* (cos M) (exp (* -0.25 (* m m)))) (exp (+ (- (fabs (- m n)) l) (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1.55e+25) {
tmp = cos(M) * exp((-0.25 * (m * m)));
} else {
tmp = exp(((fabs((m - n)) - l) + (-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 (m <= (-1.55d+25)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
else
tmp = exp(((abs((m - n)) - l) + ((-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 (m <= -1.55e+25) {
tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
} else {
tmp = Math.exp(((Math.abs((m - n)) - l) + (-0.25 * (n * n))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -1.55e+25: tmp = math.cos(M) * math.exp((-0.25 * (m * m))) else: tmp = math.exp(((math.fabs((m - n)) - l) + (-0.25 * (n * n)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -1.55e+25) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m)))); else tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) + Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -1.55e+25) tmp = cos(M) * exp((-0.25 * (m * m))); else tmp = exp(((abs((m - n)) - l) + (-0.25 * (n * n)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -1.55e+25], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] + N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.55 \cdot 10^{+25}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) + -0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if m < -1.5499999999999999e25Initial program 71.0%
*-commutative71.0%
associate-*r/71.0%
associate--r-71.0%
+-commutative71.0%
associate-+r-71.0%
unsub-neg71.0%
associate--r+71.0%
+-commutative71.0%
associate--r+71.0%
Simplified71.0%
Taylor expanded in K around 0 98.6%
cos-neg98.6%
Simplified98.6%
Taylor expanded in m around inf 98.6%
*-commutative98.6%
unpow298.6%
Simplified98.6%
if -1.5499999999999999e25 < m Initial program 80.5%
*-commutative80.5%
associate-*r/80.5%
associate--r-80.5%
+-commutative80.5%
associate-+r-80.5%
unsub-neg80.5%
associate--r+80.5%
+-commutative80.5%
associate--r+80.5%
Simplified80.5%
Taylor expanded in K around 0 92.8%
cos-neg92.8%
Simplified92.8%
Taylor expanded in n around inf 61.7%
*-commutative61.7%
unpow261.7%
Simplified61.7%
Taylor expanded in M around 0 60.0%
exp-diff18.2%
sub-neg18.2%
mul-1-neg18.2%
+-commutative18.2%
remove-double-neg18.2%
mul-1-neg18.2%
mul-1-neg18.2%
distribute-neg-in18.2%
exp-diff60.0%
associate--r+60.0%
*-commutative60.0%
unpow260.0%
associate-*r*60.0%
Simplified60.0%
Final simplification70.4%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -2.25e-5) (not (<= M 1.1e-5))) (* (cos M) (exp (* M (- M)))) (* (cos M) (exp (* -0.25 (* m m))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -2.25e-5) || !(M <= 1.1e-5)) {
tmp = cos(M) * exp((M * -M));
} else {
tmp = cos(M) * exp((-0.25 * (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_1 <= (-2.25d-5)) .or. (.not. (m_1 <= 1.1d-5))) then
tmp = cos(m_1) * exp((m_1 * -m_1))
else
tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -2.25e-5) || !(M <= 1.1e-5)) {
tmp = Math.cos(M) * Math.exp((M * -M));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -2.25e-5) or not (M <= 1.1e-5): tmp = math.cos(M) * math.exp((M * -M)) else: tmp = math.cos(M) * math.exp((-0.25 * (m * m))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -2.25e-5) || !(M <= 1.1e-5)) tmp = Float64(cos(M) * exp(Float64(M * Float64(-M)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -2.25e-5) || ~((M <= 1.1e-5))) tmp = cos(M) * exp((M * -M)); else tmp = cos(M) * exp((-0.25 * (m * m))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -2.25e-5], N[Not[LessEqual[M, 1.1e-5]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * (-M)), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -2.25 \cdot 10^{-5} \lor \neg \left(M \leq 1.1 \cdot 10^{-5}\right):\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\end{array}
\end{array}
if M < -2.25000000000000014e-5 or 1.1e-5 < M Initial program 82.0%
*-commutative82.0%
associate-*r/82.0%
associate--r-82.0%
+-commutative82.0%
associate-+r-82.0%
unsub-neg82.0%
associate--r+82.0%
+-commutative82.0%
associate--r+82.0%
Simplified82.0%
Taylor expanded in K around 0 99.4%
cos-neg99.4%
Simplified99.4%
Taylor expanded in M around inf 95.4%
mul-1-neg95.4%
unpow295.4%
distribute-rgt-neg-in95.4%
Simplified95.4%
if -2.25000000000000014e-5 < M < 1.1e-5Initial program 73.8%
*-commutative73.8%
associate-*r/73.8%
associate--r-73.8%
+-commutative73.8%
associate-+r-73.8%
unsub-neg73.8%
associate--r+73.8%
+-commutative73.8%
associate--r+73.8%
Simplified73.8%
Taylor expanded in K around 0 89.3%
cos-neg89.3%
Simplified89.3%
Taylor expanded in m around inf 56.5%
*-commutative56.5%
unpow256.5%
Simplified56.5%
Final simplification75.9%
(FPCore (K m n M l)
:precision binary64
(if (<= n 1.05e-266)
(* (cos M) (exp (* -0.25 (* m m))))
(if (<= n 55.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 <= 1.05e-266) {
tmp = cos(M) * exp((-0.25 * (m * m)));
} else if (n <= 55.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 <= 1.05d-266) then
tmp = cos(m_1) * exp(((-0.25d0) * (m * m)))
else if (n <= 55.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 <= 1.05e-266) {
tmp = Math.cos(M) * Math.exp((-0.25 * (m * m)));
} else if (n <= 55.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 <= 1.05e-266: tmp = math.cos(M) * math.exp((-0.25 * (m * m))) elif n <= 55.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 <= 1.05e-266) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(m * m)))); elseif (n <= 55.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 <= 1.05e-266) tmp = cos(M) * exp((-0.25 * (m * m))); elseif (n <= 55.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, 1.05e-266], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 55.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 1.05 \cdot 10^{-266}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;n \leq 55:\\
\;\;\;\;\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 < 1.04999999999999998e-266Initial program 78.8%
*-commutative78.8%
associate-*r/78.8%
associate--r-78.8%
+-commutative78.8%
associate-+r-78.8%
unsub-neg78.8%
associate--r+78.8%
+-commutative78.8%
associate--r+78.8%
Simplified78.8%
Taylor expanded in K around 0 95.6%
cos-neg95.6%
Simplified95.6%
Taylor expanded in m around inf 59.9%
*-commutative59.9%
unpow259.9%
Simplified59.9%
if 1.04999999999999998e-266 < n < 55Initial program 76.8%
*-commutative76.8%
associate-*r/76.8%
associate--r-76.8%
+-commutative76.8%
associate-+r-76.8%
unsub-neg76.8%
associate--r+76.8%
+-commutative76.8%
associate--r+76.8%
Simplified76.8%
Taylor expanded in K around 0 87.6%
cos-neg87.6%
Simplified87.6%
Taylor expanded in M around inf 53.5%
mul-1-neg53.5%
unpow253.5%
distribute-rgt-neg-in53.5%
Simplified53.5%
if 55 < n 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 K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 95.9%
*-commutative95.9%
unpow295.9%
Simplified95.9%
Final simplification65.0%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -1.05e-6) (not (<= M 1.3e+81))) (* (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.05e-6) || !(M <= 1.3e+81)) {
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.05d-6)) .or. (.not. (m_1 <= 1.3d+81))) 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.05e-6) || !(M <= 1.3e+81)) {
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.05e-6) or not (M <= 1.3e+81): 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.05e-6) || !(M <= 1.3e+81)) 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.05e-6) || ~((M <= 1.3e+81))) 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.05e-6], N[Not[LessEqual[M, 1.3e+81]], $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.05 \cdot 10^{-6} \lor \neg \left(M \leq 1.3 \cdot 10^{+81}\right):\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(-M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if M < -1.0499999999999999e-6 or 1.29999999999999996e81 < M Initial program 82.1%
*-commutative82.1%
associate-*r/82.1%
associate--r-82.1%
+-commutative82.1%
associate-+r-82.1%
unsub-neg82.1%
associate--r+82.1%
+-commutative82.1%
associate--r+82.1%
Simplified82.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 98.2%
mul-1-neg98.2%
unpow298.2%
distribute-rgt-neg-in98.2%
Simplified98.2%
if -1.0499999999999999e-6 < M < 1.29999999999999996e81Initial program 74.5%
*-commutative74.5%
associate-*r/74.5%
associate--r-74.5%
+-commutative74.5%
associate-+r-74.5%
unsub-neg74.5%
associate--r+74.5%
+-commutative74.5%
associate--r+74.5%
Simplified74.5%
Taylor expanded in K around 0 89.5%
cos-neg89.5%
Simplified89.5%
Taylor expanded in l around inf 39.1%
neg-mul-139.1%
Simplified39.1%
Final simplification66.1%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(-l);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(-l);
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(-l)
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(-l))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(-l); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{-\ell}
\end{array}
Initial program 77.9%
*-commutative77.9%
associate-*r/77.9%
associate--r-77.9%
+-commutative77.9%
associate-+r-77.9%
unsub-neg77.9%
associate--r+77.9%
+-commutative77.9%
associate--r+77.9%
Simplified77.9%
Taylor expanded in K around 0 94.3%
cos-neg94.3%
Simplified94.3%
Taylor expanded in l around inf 34.5%
neg-mul-134.5%
Simplified34.5%
Final simplification34.5%
herbie shell --seed 2023216
(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)))))))