
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (* (cos M) (pow E (- (- (fabs (- m n)) l) (pow (fma 0.5 (+ m n) (- M)) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * pow(((double) M_E), ((fabs((m - n)) - l) - pow(fma(0.5, (m + n), -M), 2.0)));
}
function code(K, m, n, M, l) return Float64(cos(M) * (exp(1) ^ Float64(Float64(abs(Float64(m - n)) - l) - (fma(0.5, Float64(m + n), Float64(-M)) ^ 2.0)))) end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Power[E, N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(0.5 * N[(m + n), $MachinePrecision] + (-M)), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot {e}^{\left(\left(\left|m - n\right| - \ell\right) - {\left(\mathsf{fma}\left(0.5, m + n, -M\right)\right)}^{2}\right)}
\end{array}
Initial program 75.8%
associate-/l*76.5%
+-commutative76.5%
fabs-sub76.5%
+-commutative76.5%
Simplified76.5%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
*-un-lft-identity97.0%
exp-prod97.0%
associate--r-97.0%
div-inv97.0%
metadata-eval97.0%
fma-neg97.0%
Applied egg-rr97.0%
Simplified97.0%
Final simplification97.0%
(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 75.8%
associate-/l*76.5%
+-commutative76.5%
fabs-sub76.5%
+-commutative76.5%
Simplified76.5%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Final simplification97.0%
(FPCore (K m n M l)
:precision binary64
(if (<= m -1000000000.0)
(* (cos M) (exp (* (pow m 2.0) -0.25)))
(*
(cos M)
(pow
E
(- (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (- l (fabs (- m n))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1000000000.0) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} else {
tmp = cos(M) * pow(((double) M_E), ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - fabs((m - n)))));
}
return tmp;
}
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1000000000.0) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.cos(M) * Math.pow(Math.E, ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - Math.abs((m - n)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -1000000000.0: tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.cos(M) * math.pow(math.e, ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - math.fabs((m - n))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -1000000000.0) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); else tmp = Float64(cos(M) * (exp(1) ^ Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) - Float64(l - abs(Float64(m - n)))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -1000000000.0) tmp = cos(M) * exp(((m ^ 2.0) * -0.25)); else tmp = cos(M) * (2.71828182845904523536 ^ ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - abs((m - n))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -1000000000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Power[E, N[(N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision] - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1000000000:\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot {e}^{\left(\left(n \cdot 0.5 - M\right) \cdot \left(\left(M - n \cdot 0.5\right) - m\right) - \left(\ell - \left|m - n\right|\right)\right)}\\
\end{array}
\end{array}
if m < -1e9Initial program 68.9%
associate-/l*68.9%
+-commutative68.9%
fabs-sub68.9%
+-commutative68.9%
Simplified68.9%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 91.9%
+-commutative91.9%
unpow291.9%
distribute-rgt-out95.2%
*-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in m around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -1e9 < m Initial program 77.9%
associate-/l*79.0%
+-commutative79.0%
fabs-sub79.0%
+-commutative79.0%
Simplified79.0%
Taylor expanded in K around 0 96.0%
cos-neg96.0%
Simplified96.0%
*-un-lft-identity96.0%
exp-prod96.0%
associate--r-96.0%
div-inv96.0%
metadata-eval96.0%
fma-neg96.0%
Applied egg-rr96.0%
Simplified96.0%
Taylor expanded in m around 0 80.3%
unpow280.3%
distribute-rgt-in82.4%
Simplified82.4%
Final simplification86.6%
(FPCore (K m n M l)
:precision binary64
(if (<= n 1e+24)
(*
(cos M)
(exp (+ (* (- (* m 0.5) M) (- (- M (* m 0.5)) n)) (- (fabs (- m n)) l))))
(* (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 <= 1e+24) {
tmp = cos(M) * exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (fabs((m - n)) - l)));
} 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 <= 1d+24) then
tmp = cos(m_1) * exp(((((m * 0.5d0) - m_1) * ((m_1 - (m * 0.5d0)) - n)) + (abs((m - n)) - l)))
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 <= 1e+24) {
tmp = Math.cos(M) * Math.exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (Math.abs((m - n)) - l)));
} 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 <= 1e+24: tmp = math.cos(M) * math.exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (math.fabs((m - n)) - l))) 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 <= 1e+24) tmp = Float64(cos(M) * exp(Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - Float64(m * 0.5)) - n)) + Float64(abs(Float64(m - n)) - l)))); 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 <= 1e+24) tmp = cos(M) * exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (abs((m - n)) - l))); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1e+24], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $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 10^{+24}:\\
\;\;\;\;\cos M \cdot e^{\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - m \cdot 0.5\right) - n\right) + \left(\left|m - n\right| - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 9.9999999999999998e23Initial program 74.4%
associate-/l*75.4%
+-commutative75.4%
fabs-sub75.4%
+-commutative75.4%
Simplified75.4%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in n around 0 77.8%
+-commutative77.8%
unpow277.8%
distribute-rgt-out83.3%
*-commutative83.3%
*-commutative83.3%
Simplified83.3%
if 9.9999999999999998e23 < n Initial program 81.1%
associate-/l*81.1%
+-commutative81.1%
fabs-sub81.1%
+-commutative81.1%
Simplified81.1%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Taylor expanded in l around 0 98.1%
Taylor expanded in n around inf 98.1%
*-commutative98.1%
Simplified98.1%
Final simplification86.3%
(FPCore (K m n M l)
:precision binary64
(if (<= m -10000.0)
(* (cos M) (exp (* (pow m 2.0) -0.25)))
(*
(cos M)
(exp (- (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (- l (fabs (- m n))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -10000.0) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} else {
tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - fabs((m - 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 <= (-10000.0d0)) then
tmp = cos(m_1) * exp(((m ** 2.0d0) * (-0.25d0)))
else
tmp = cos(m_1) * exp(((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) - (l - abs((m - 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 <= -10000.0) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.cos(M) * Math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - Math.abs((m - n)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -10000.0: tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.cos(M) * math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - math.fabs((m - n))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -10000.0) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); else tmp = Float64(cos(M) * exp(Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) - Float64(l - abs(Float64(m - n)))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -10000.0) tmp = cos(M) * exp(((m ^ 2.0) * -0.25)); else tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - (l - abs((m - n))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -10000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision] - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -10000:\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(n \cdot 0.5 - M\right) \cdot \left(\left(M - n \cdot 0.5\right) - m\right) - \left(\ell - \left|m - n\right|\right)}\\
\end{array}
\end{array}
if m < -1e4Initial program 68.9%
associate-/l*68.9%
+-commutative68.9%
fabs-sub68.9%
+-commutative68.9%
Simplified68.9%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 91.9%
+-commutative91.9%
unpow291.9%
distribute-rgt-out95.2%
*-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in m around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -1e4 < m Initial program 77.9%
associate-/l*79.0%
+-commutative79.0%
fabs-sub79.0%
+-commutative79.0%
Simplified79.0%
Taylor expanded in K around 0 96.0%
cos-neg96.0%
Simplified96.0%
Taylor expanded in m around 0 80.3%
+-commutative80.3%
unpow280.3%
distribute-rgt-out82.4%
*-commutative82.4%
*-commutative82.4%
Simplified82.4%
Final simplification86.6%
(FPCore (K m n M l)
:precision binary64
(if (<= M -2.25e-46)
(* (cos M) (exp (* M (- n M))))
(if (<= M 1.1e-13)
(* (cos M) (exp (* (pow m 2.0) -0.25)))
(* (cos M) (exp (- (pow M 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -2.25e-46) {
tmp = cos(M) * exp((M * (n - M)));
} else if (M <= 1.1e-13) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} else {
tmp = cos(M) * exp(-pow(M, 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 (m_1 <= (-2.25d-46)) then
tmp = cos(m_1) * exp((m_1 * (n - m_1)))
else if (m_1 <= 1.1d-13) then
tmp = cos(m_1) * exp(((m ** 2.0d0) * (-0.25d0)))
else
tmp = cos(m_1) * exp(-(m_1 ** 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 (M <= -2.25e-46) {
tmp = Math.cos(M) * Math.exp((M * (n - M)));
} else if (M <= 1.1e-13) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= -2.25e-46: tmp = math.cos(M) * math.exp((M * (n - M))) elif M <= 1.1e-13: tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= -2.25e-46) tmp = Float64(cos(M) * exp(Float64(M * Float64(n - M)))); elseif (M <= 1.1e-13) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); else tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= -2.25e-46) tmp = cos(M) * exp((M * (n - M))); elseif (M <= 1.1e-13) tmp = cos(M) * exp(((m ^ 2.0) * -0.25)); else tmp = cos(M) * exp(-(M ^ 2.0)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, -2.25e-46], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.1e-13], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -2.25 \cdot 10^{-46}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(n - M\right)}\\
\mathbf{elif}\;M \leq 1.1 \cdot 10^{-13}:\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\end{array}
\end{array}
if M < -2.25e-46Initial program 76.9%
associate-/l*76.9%
+-commutative76.9%
fabs-sub76.9%
+-commutative76.9%
Simplified76.9%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in n around 0 78.3%
+-commutative78.3%
unpow278.3%
distribute-rgt-out88.6%
*-commutative88.6%
*-commutative88.6%
Simplified88.6%
Taylor expanded in m around 0 79.8%
associate--r+79.8%
associate-*r*79.8%
neg-mul-179.8%
cancel-sign-sub79.8%
Simplified79.8%
Taylor expanded in M around inf 77.2%
+-commutative77.2%
mul-1-neg77.2%
unpow277.2%
distribute-rgt-neg-in77.2%
distribute-lft-in84.9%
sub-neg84.9%
Simplified84.9%
if -2.25e-46 < M < 1.09999999999999998e-13Initial program 73.1%
associate-/l*75.0%
+-commutative75.0%
fabs-sub75.0%
+-commutative75.0%
Simplified75.0%
Taylor expanded in K around 0 93.7%
cos-neg93.7%
Simplified93.7%
Taylor expanded in n around 0 64.8%
+-commutative64.8%
unpow264.8%
distribute-rgt-out67.6%
*-commutative67.6%
*-commutative67.6%
Simplified67.6%
Taylor expanded in m around inf 59.0%
*-commutative59.0%
Simplified59.0%
if 1.09999999999999998e-13 < M Initial program 78.6%
associate-/l*78.6%
+-commutative78.6%
fabs-sub78.6%
+-commutative78.6%
Simplified78.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 78.7%
+-commutative78.7%
unpow278.7%
distribute-rgt-out88.8%
*-commutative88.8%
*-commutative88.8%
Simplified88.8%
Taylor expanded in M around inf 95.8%
mul-1-neg95.8%
Simplified95.8%
Final simplification77.0%
(FPCore (K m n M l)
:precision binary64
(if (<= n 8.5e-293)
(* (cos M) (exp (* (pow m 2.0) -0.25)))
(if (<= n 56.0)
(* (cos M) (exp (+ (- n m) (- (* M (- n M)) l))))
(* (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 <= 8.5e-293) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} else if (n <= 56.0) {
tmp = cos(M) * exp(((n - m) + ((M * (n - M)) - l)));
} 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 <= 8.5d-293) then
tmp = cos(m_1) * exp(((m ** 2.0d0) * (-0.25d0)))
else if (n <= 56.0d0) then
tmp = cos(m_1) * exp(((n - m) + ((m_1 * (n - m_1)) - l)))
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 <= 8.5e-293) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (n <= 56.0) {
tmp = Math.cos(M) * Math.exp(((n - m) + ((M * (n - M)) - l)));
} 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 <= 8.5e-293: tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) elif n <= 56.0: tmp = math.cos(M) * math.exp(((n - m) + ((M * (n - M)) - l))) 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 <= 8.5e-293) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); elseif (n <= 56.0) tmp = Float64(cos(M) * exp(Float64(Float64(n - m) + Float64(Float64(M * Float64(n - M)) - l)))); 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 <= 8.5e-293) tmp = cos(M) * exp(((m ^ 2.0) * -0.25)); elseif (n <= 56.0) tmp = cos(M) * exp(((n - m) + ((M * (n - M)) - l))); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 8.5e-293], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 56.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] - l), $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 8.5 \cdot 10^{-293}:\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;n \leq 56:\\
\;\;\;\;\cos M \cdot e^{\left(n - m\right) + \left(M \cdot \left(n - M\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 8.50000000000000044e-293Initial program 72.9%
associate-/l*72.9%
+-commutative72.9%
fabs-sub72.9%
+-commutative72.9%
Simplified72.9%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 70.8%
+-commutative70.8%
unpow270.8%
distribute-rgt-out79.4%
*-commutative79.4%
*-commutative79.4%
Simplified79.4%
Taylor expanded in m around inf 57.2%
*-commutative57.2%
Simplified57.2%
if 8.50000000000000044e-293 < n < 56Initial program 76.1%
associate-/l*79.1%
+-commutative79.1%
fabs-sub79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in K around 0 89.9%
cos-neg89.9%
Simplified89.9%
Taylor expanded in n around 0 88.9%
+-commutative88.9%
unpow288.9%
distribute-rgt-out88.9%
*-commutative88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in m around 0 65.4%
associate--r+65.4%
associate-*r*65.4%
neg-mul-165.4%
cancel-sign-sub65.4%
Simplified65.4%
associate-+l-65.4%
add-sqr-sqrt45.7%
fabs-sqr45.7%
add-sqr-sqrt80.1%
Applied egg-rr80.1%
if 56 < n Initial program 81.7%
associate-/l*81.7%
+-commutative81.7%
fabs-sub81.7%
+-commutative81.7%
Simplified81.7%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in l around 0 98.4%
Taylor expanded in n around inf 98.4%
*-commutative98.4%
Simplified98.4%
Final simplification72.8%
(FPCore (K m n M l) :precision binary64 (if (<= l -4.0) (* (cos M) (exp l)) (if (<= l 6.6e-24) (* (cos M) (exp (- (pow M 2.0)))) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -4.0) {
tmp = cos(M) * exp(l);
} else if (l <= 6.6e-24) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = 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 <= (-4.0d0)) then
tmp = cos(m_1) * exp(l)
else if (l <= 6.6d-24) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = 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 <= -4.0) {
tmp = Math.cos(M) * Math.exp(l);
} else if (l <= 6.6e-24) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -4.0: tmp = math.cos(M) * math.exp(l) elif l <= 6.6e-24: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -4.0) tmp = Float64(cos(M) * exp(l)); elseif (l <= 6.6e-24) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= -4.0) tmp = cos(M) * exp(l); elseif (l <= 6.6e-24) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -4.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 6.6e-24], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 6.6 \cdot 10^{-24}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -4Initial program 74.1%
associate-/l*77.6%
+-commutative77.6%
fabs-sub77.6%
+-commutative77.6%
Simplified77.6%
Taylor expanded in K around 0 94.8%
cos-neg94.8%
Simplified94.8%
Taylor expanded in n around 0 72.7%
+-commutative72.7%
unpow272.7%
distribute-rgt-out79.6%
*-commutative79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in l around inf 20.2%
neg-mul-120.2%
Simplified20.2%
pow120.2%
add-sqr-sqrt20.2%
sqrt-unprod20.2%
sqr-neg20.2%
sqrt-unprod0.0%
add-sqr-sqrt74.6%
Applied egg-rr74.6%
unpow174.6%
Simplified74.6%
if -4 < l < 6.59999999999999968e-24Initial program 75.0%
associate-/l*75.0%
+-commutative75.0%
fabs-sub75.0%
+-commutative75.0%
Simplified75.0%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in n around 0 68.8%
+-commutative68.8%
unpow268.8%
distribute-rgt-out76.4%
*-commutative76.4%
*-commutative76.4%
Simplified76.4%
Taylor expanded in M around inf 64.6%
mul-1-neg64.6%
Simplified64.6%
if 6.59999999999999968e-24 < l Initial program 79.6%
associate-/l*79.6%
+-commutative79.6%
fabs-sub79.6%
+-commutative79.6%
Simplified79.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 83.4%
+-commutative83.4%
unpow283.4%
distribute-rgt-out89.1%
*-commutative89.1%
*-commutative89.1%
Simplified89.1%
Taylor expanded in l around inf 96.4%
neg-mul-196.4%
Simplified96.4%
Taylor expanded in M around 0 96.4%
Final simplification73.5%
(FPCore (K m n M l) :precision binary64 (if (<= l -730.0) (* (cos M) (exp l)) (if (<= l 4.3e-30) (* (cos M) (exp (* M (- n M)))) (/ (cos M) (exp l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -730.0) {
tmp = cos(M) * exp(l);
} else if (l <= 4.3e-30) {
tmp = cos(M) * exp((M * (n - M)));
} else {
tmp = cos(M) / exp(l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= (-730.0d0)) then
tmp = cos(m_1) * exp(l)
else if (l <= 4.3d-30) then
tmp = cos(m_1) * exp((m_1 * (n - m_1)))
else
tmp = cos(m_1) / exp(l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -730.0) {
tmp = Math.cos(M) * Math.exp(l);
} else if (l <= 4.3e-30) {
tmp = Math.cos(M) * Math.exp((M * (n - M)));
} else {
tmp = Math.cos(M) / Math.exp(l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -730.0: tmp = math.cos(M) * math.exp(l) elif l <= 4.3e-30: tmp = math.cos(M) * math.exp((M * (n - M))) else: tmp = math.cos(M) / math.exp(l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -730.0) tmp = Float64(cos(M) * exp(l)); elseif (l <= 4.3e-30) tmp = Float64(cos(M) * exp(Float64(M * Float64(n - M)))); 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 <= -730.0) tmp = cos(M) * exp(l); elseif (l <= 4.3e-30) tmp = cos(M) * exp((M * (n - M))); else tmp = cos(M) / exp(l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -730.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e-30], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -730:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-30}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(n - M\right)}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\end{array}
\end{array}
if l < -730Initial program 75.4%
associate-/l*78.9%
+-commutative78.9%
fabs-sub78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in K around 0 94.7%
cos-neg94.7%
Simplified94.7%
Taylor expanded in n around 0 72.2%
+-commutative72.2%
unpow272.2%
distribute-rgt-out79.2%
*-commutative79.2%
*-commutative79.2%
Simplified79.2%
Taylor expanded in l around inf 20.5%
neg-mul-120.5%
Simplified20.5%
pow120.5%
add-sqr-sqrt20.5%
sqrt-unprod20.5%
sqr-neg20.5%
sqrt-unprod0.0%
add-sqr-sqrt75.8%
Applied egg-rr75.8%
unpow175.8%
Simplified75.8%
if -730 < l < 4.29999999999999966e-30Initial program 73.9%
associate-/l*73.9%
+-commutative73.9%
fabs-sub73.9%
+-commutative73.9%
Simplified73.9%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in n around 0 69.7%
+-commutative69.7%
unpow269.7%
distribute-rgt-out76.8%
*-commutative76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in m around 0 52.5%
associate--r+52.5%
associate-*r*52.5%
neg-mul-152.5%
cancel-sign-sub52.5%
Simplified52.5%
Taylor expanded in M around inf 56.2%
+-commutative56.2%
mul-1-neg56.2%
unpow256.2%
distribute-rgt-neg-in56.2%
distribute-lft-in61.9%
sub-neg61.9%
Simplified61.9%
if 4.29999999999999966e-30 < l Initial program 80.7%
associate-/l*80.7%
+-commutative80.7%
fabs-sub80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 80.8%
+-commutative80.8%
unpow280.8%
distribute-rgt-out87.9%
*-commutative87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in l around inf 93.2%
neg-mul-193.2%
Simplified93.2%
exp-neg93.2%
un-div-inv93.2%
Applied egg-rr93.2%
Final simplification72.0%
(FPCore (K m n M l) :precision binary64 (if (<= l -720.0) (* (cos M) (exp l)) (if (<= l 4.3e-30) (* (cos M) (exp (* M n))) (/ (cos M) (exp l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -720.0) {
tmp = cos(M) * exp(l);
} else if (l <= 4.3e-30) {
tmp = cos(M) * exp((M * 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 <= (-720.0d0)) then
tmp = cos(m_1) * exp(l)
else if (l <= 4.3d-30) then
tmp = cos(m_1) * exp((m_1 * 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 <= -720.0) {
tmp = Math.cos(M) * Math.exp(l);
} else if (l <= 4.3e-30) {
tmp = Math.cos(M) * Math.exp((M * n));
} else {
tmp = Math.cos(M) / Math.exp(l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -720.0: tmp = math.cos(M) * math.exp(l) elif l <= 4.3e-30: tmp = math.cos(M) * math.exp((M * n)) else: tmp = math.cos(M) / math.exp(l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -720.0) tmp = Float64(cos(M) * exp(l)); elseif (l <= 4.3e-30) tmp = Float64(cos(M) * exp(Float64(M * 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 <= -720.0) tmp = cos(M) * exp(l); elseif (l <= 4.3e-30) tmp = cos(M) * exp((M * n)); else tmp = cos(M) / exp(l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -720.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 4.3e-30], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -720:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 4.3 \cdot 10^{-30}:\\
\;\;\;\;\cos M \cdot e^{M \cdot n}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\end{array}
\end{array}
if l < -720Initial program 75.4%
associate-/l*78.9%
+-commutative78.9%
fabs-sub78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in K around 0 94.7%
cos-neg94.7%
Simplified94.7%
Taylor expanded in n around 0 72.2%
+-commutative72.2%
unpow272.2%
distribute-rgt-out79.2%
*-commutative79.2%
*-commutative79.2%
Simplified79.2%
Taylor expanded in l around inf 20.5%
neg-mul-120.5%
Simplified20.5%
pow120.5%
add-sqr-sqrt20.5%
sqrt-unprod20.5%
sqr-neg20.5%
sqrt-unprod0.0%
add-sqr-sqrt75.8%
Applied egg-rr75.8%
unpow175.8%
Simplified75.8%
if -720 < l < 4.29999999999999966e-30Initial program 73.9%
associate-/l*73.9%
+-commutative73.9%
fabs-sub73.9%
+-commutative73.9%
Simplified73.9%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in n around 0 69.7%
+-commutative69.7%
unpow269.7%
distribute-rgt-out76.8%
*-commutative76.8%
*-commutative76.8%
Simplified76.8%
Taylor expanded in m around 0 52.5%
associate--r+52.5%
associate-*r*52.5%
neg-mul-152.5%
cancel-sign-sub52.5%
Simplified52.5%
Taylor expanded in n around inf 33.7%
*-commutative33.7%
Simplified33.7%
if 4.29999999999999966e-30 < l Initial program 80.7%
associate-/l*80.7%
+-commutative80.7%
fabs-sub80.7%
+-commutative80.7%
Simplified80.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 80.8%
+-commutative80.8%
unpow280.8%
distribute-rgt-out87.9%
*-commutative87.9%
*-commutative87.9%
Simplified87.9%
Taylor expanded in l around inf 93.2%
neg-mul-193.2%
Simplified93.2%
exp-neg93.2%
un-div-inv93.2%
Applied egg-rr93.2%
Final simplification56.3%
(FPCore (K m n M l) :precision binary64 (if (<= l -1.26e-15) (* (cos M) (exp l)) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -1.26e-15) {
tmp = cos(M) * exp(l);
} else {
tmp = 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 <= (-1.26d-15)) then
tmp = cos(m_1) * exp(l)
else
tmp = 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 <= -1.26e-15) {
tmp = Math.cos(M) * Math.exp(l);
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -1.26e-15: tmp = math.cos(M) * math.exp(l) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -1.26e-15) tmp = Float64(cos(M) * exp(l)); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= -1.26e-15) tmp = cos(M) * exp(l); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -1.26e-15], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1.26 \cdot 10^{-15}:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -1.26e-15Initial program 75.7%
associate-/l*78.9%
+-commutative78.9%
fabs-sub78.9%
+-commutative78.9%
Simplified78.9%
Taylor expanded in K around 0 93.7%
cos-neg93.7%
Simplified93.7%
Taylor expanded in n around 0 73.3%
+-commutative73.3%
unpow273.3%
distribute-rgt-out79.6%
*-commutative79.6%
*-commutative79.6%
Simplified79.6%
Taylor expanded in l around inf 18.8%
neg-mul-118.8%
Simplified18.8%
pow118.8%
add-sqr-sqrt18.8%
sqrt-unprod18.8%
sqr-neg18.8%
sqrt-unprod0.0%
add-sqr-sqrt68.9%
Applied egg-rr68.9%
unpow168.9%
Simplified68.9%
if -1.26e-15 < l Initial program 75.8%
associate-/l*75.8%
+-commutative75.8%
fabs-sub75.8%
+-commutative75.8%
Simplified75.8%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in n around 0 72.6%
+-commutative72.6%
unpow272.6%
distribute-rgt-out79.9%
*-commutative79.9%
*-commutative79.9%
Simplified79.9%
Taylor expanded in l around inf 33.9%
neg-mul-133.9%
Simplified33.9%
Taylor expanded in M around 0 33.9%
Final simplification42.5%
(FPCore (K m n M l) :precision binary64 (if (<= l -8.8e-10) (* (cos M) (exp l)) (/ (cos M) (exp l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -8.8e-10) {
tmp = cos(M) * exp(l);
} 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 <= (-8.8d-10)) then
tmp = cos(m_1) * exp(l)
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 <= -8.8e-10) {
tmp = Math.cos(M) * Math.exp(l);
} else {
tmp = Math.cos(M) / Math.exp(l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -8.8e-10: tmp = math.cos(M) * math.exp(l) else: tmp = math.cos(M) / math.exp(l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -8.8e-10) tmp = Float64(cos(M) * exp(l)); 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 <= -8.8e-10) tmp = cos(M) * exp(l); else tmp = cos(M) / exp(l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -8.8e-10], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -8.8 \cdot 10^{-10}:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\end{array}
\end{array}
if l < -8.7999999999999996e-10Initial program 75.3%
associate-/l*78.5%
+-commutative78.5%
fabs-sub78.5%
+-commutative78.5%
Simplified78.5%
Taylor expanded in K around 0 93.6%
cos-neg93.6%
Simplified93.6%
Taylor expanded in n around 0 72.8%
+-commutative72.8%
unpow272.8%
distribute-rgt-out79.3%
*-commutative79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in l around inf 19.1%
neg-mul-119.1%
Simplified19.1%
pow119.1%
add-sqr-sqrt19.1%
sqrt-unprod19.1%
sqr-neg19.1%
sqrt-unprod0.0%
add-sqr-sqrt69.9%
Applied egg-rr69.9%
unpow169.9%
Simplified69.9%
if -8.7999999999999996e-10 < l Initial program 75.9%
associate-/l*75.9%
+-commutative75.9%
fabs-sub75.9%
+-commutative75.9%
Simplified75.9%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Taylor expanded in n around 0 72.7%
+-commutative72.7%
unpow272.7%
distribute-rgt-out80.0%
*-commutative80.0%
*-commutative80.0%
Simplified80.0%
Taylor expanded in l around inf 33.8%
neg-mul-133.8%
Simplified33.8%
exp-neg33.8%
un-div-inv33.8%
Applied egg-rr33.8%
Final simplification42.5%
(FPCore (K m n M l) :precision binary64 (exp (- l)))
double code(double K, double m, double n, double M, double l) {
return 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 = exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
def code(K, m, n, M, l): return math.exp(-l)
function code(K, m, n, M, l) return exp(Float64(-l)) end
function tmp = code(K, m, n, M, l) tmp = exp(-l); end
code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
\\
e^{-\ell}
\end{array}
Initial program 75.8%
associate-/l*76.5%
+-commutative76.5%
fabs-sub76.5%
+-commutative76.5%
Simplified76.5%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in n around 0 72.7%
+-commutative72.7%
unpow272.7%
distribute-rgt-out79.8%
*-commutative79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in l around inf 30.2%
neg-mul-130.2%
Simplified30.2%
Taylor expanded in M around 0 29.4%
Final simplification29.4%
(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 75.8%
associate-/l*76.5%
+-commutative76.5%
fabs-sub76.5%
+-commutative76.5%
Simplified76.5%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in n around 0 72.7%
+-commutative72.7%
unpow272.7%
distribute-rgt-out79.8%
*-commutative79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in l around inf 30.2%
neg-mul-130.2%
Simplified30.2%
Taylor expanded in l around 0 6.6%
Final simplification6.6%
herbie shell --seed 2024039
(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)))))))