
(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) (exp (pow (cbrt (- (fabs (- m n)) (+ (pow (- (* (+ m n) 0.5) M) 2.0) l))) 3.0))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(pow(cbrt((fabs((m - n)) - (pow((((m + n) * 0.5) - M), 2.0) + l))), 3.0));
}
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(Math.pow(Math.cbrt((Math.abs((m - n)) - (Math.pow((((m + n) * 0.5) - M), 2.0) + l))), 3.0));
}
function code(K, m, n, M, l) return Float64(cos(M) * exp((cbrt(Float64(abs(Float64(m - n)) - Float64((Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0) + l))) ^ 3.0))) end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[Power[N[Power[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{{\left(\sqrt[3]{\left|m - n\right| - \left({\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2} + \ell\right)}\right)}^{3}}
\end{array}
Initial program 78.4%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
add-cube-cbrt96.1%
pow396.1%
associate--r-96.1%
div-inv96.1%
metadata-eval96.1%
Applied egg-rr96.1%
Final simplification96.1%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (fabs (- m n)) l) (exp (log (pow (- (* (+ m n) 0.5) M) 2.0)))))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((m - n)) - l) - exp(log(pow((((m + n) * 0.5) - M), 2.0)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp(((abs((m - n)) - l) - exp(log(((((m + n) * 0.5d0) - m_1) ** 2.0d0)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - Math.exp(Math.log(Math.pow((((m + n) * 0.5) - M), 2.0)))));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((m - n)) - l) - math.exp(math.log(math.pow((((m + n) * 0.5) - M), 2.0)))))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - exp(log((Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0)))))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) - exp(log(((((m + n) * 0.5) - 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[Exp[N[Log[N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]], $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - e^{\log \left({\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}}
\end{array}
Initial program 78.4%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
add-exp-log96.1%
div-inv96.1%
metadata-eval96.1%
Applied egg-rr96.1%
Final simplification96.1%
(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 78.4%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Final simplification96.1%
(FPCore (K m n M l)
:precision binary64
(if (<= m -0.00185)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= m -1.8e-90)
(* (cos M) (exp (- (pow M 2.0))))
(*
(cos M)
(exp (- (- (fabs (- m n)) l) (* (* n 0.5) (+ m (* n 0.5)))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.00185) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (m <= -1.8e-90) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp(((fabs((m - n)) - l) - ((n * 0.5) * (m + (n * 0.5)))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-0.00185d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= (-1.8d-90)) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp(((abs((m - n)) - l) - ((n * 0.5d0) * (m + (n * 0.5d0)))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.00185) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= -1.8e-90) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - ((n * 0.5) * (m + (n * 0.5)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -0.00185: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif m <= -1.8e-90: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp(((math.fabs((m - n)) - l) - ((n * 0.5) * (m + (n * 0.5))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -0.00185) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (m <= -1.8e-90) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(Float64(n * 0.5) * Float64(m + Float64(n * 0.5)))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -0.00185) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (m <= -1.8e-90) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp(((abs((m - n)) - l) - ((n * 0.5) * (m + (n * 0.5))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.00185], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -1.8e-90], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(N[(n * 0.5), $MachinePrecision] * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00185:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -1.8 \cdot 10^{-90}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - \left(n \cdot 0.5\right) \cdot \left(m + n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < -0.0018500000000000001Initial program 72.6%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in m around inf 95.2%
if -0.0018500000000000001 < m < -1.7999999999999999e-90Initial program 100.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 75.8%
mul-1-neg75.8%
Simplified75.8%
if -1.7999999999999999e-90 < m Initial program 79.8%
Taylor expanded in K around 0 95.8%
cos-neg95.8%
Simplified95.8%
Taylor expanded in m around 0 82.1%
+-commutative82.1%
unpow282.1%
distribute-rgt-out86.9%
*-commutative86.9%
*-commutative86.9%
Simplified86.9%
Taylor expanded in M around 0 67.3%
associate--r+67.3%
associate-*r*67.3%
*-commutative67.3%
*-commutative67.3%
Simplified67.3%
Final simplification74.2%
(FPCore (K m n M l)
:precision binary64
(if (<= m -0.00185)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(cos M)
(exp (+ (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (- (fabs (- m n)) l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.00185) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (fabs((m - n)) - l)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-0.00185d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) + (abs((m - n)) - l)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.00185) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (Math.abs((m - n)) - l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -0.00185: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (math.fabs((m - n)) - l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -0.00185) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) + Float64(abs(Float64(m - n)) - l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -0.00185) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (abs((m - n)) - l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.00185], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00185:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\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(\left|m - n\right| - \ell\right)}\\
\end{array}
\end{array}
if m < -0.0018500000000000001Initial program 72.6%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in m around inf 95.2%
if -0.0018500000000000001 < m Initial program 80.2%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in m around 0 82.5%
+-commutative82.5%
unpow282.5%
distribute-rgt-out87.2%
*-commutative87.2%
*-commutative87.2%
Simplified87.2%
Final simplification89.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- (pow M 2.0))))) (t_1 (- (* m 0.5) M)))
(if (<= m -0.00185)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= m -9e-220)
t_0
(if (<= m -9.8e-247)
(*
(cos (* (+ m n) (* 0.5 K)))
(exp (+ (- m n) (- (* t_1 (+ n t_1)) l))))
(if (<= m 8.5e-198) t_0 (* (cos M) (exp (* m (- M (* n 0.5)))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-pow(M, 2.0));
double t_1 = (m * 0.5) - M;
double tmp;
if (m <= -0.00185) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (m <= -9e-220) {
tmp = t_0;
} else if (m <= -9.8e-247) {
tmp = cos(((m + n) * (0.5 * K))) * exp(((m - n) + ((t_1 * (n + t_1)) - l)));
} else if (m <= 8.5e-198) {
tmp = t_0;
} else {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = cos(m_1) * exp(-(m_1 ** 2.0d0))
t_1 = (m * 0.5d0) - m_1
if (m <= (-0.00185d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= (-9d-220)) then
tmp = t_0
else if (m <= (-9.8d-247)) then
tmp = cos(((m + n) * (0.5d0 * k))) * exp(((m - n) + ((t_1 * (n + t_1)) - l)))
else if (m <= 8.5d-198) then
tmp = t_0
else
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double t_1 = (m * 0.5) - M;
double tmp;
if (m <= -0.00185) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= -9e-220) {
tmp = t_0;
} else if (m <= -9.8e-247) {
tmp = Math.cos(((m + n) * (0.5 * K))) * Math.exp(((m - n) + ((t_1 * (n + t_1)) - l)));
} else if (m <= 8.5e-198) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-math.pow(M, 2.0)) t_1 = (m * 0.5) - M tmp = 0 if m <= -0.00185: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif m <= -9e-220: tmp = t_0 elif m <= -9.8e-247: tmp = math.cos(((m + n) * (0.5 * K))) * math.exp(((m - n) + ((t_1 * (n + t_1)) - l))) elif m <= 8.5e-198: tmp = t_0 else: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) t_1 = Float64(Float64(m * 0.5) - M) tmp = 0.0 if (m <= -0.00185) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (m <= -9e-220) tmp = t_0; elseif (m <= -9.8e-247) tmp = Float64(cos(Float64(Float64(m + n) * Float64(0.5 * K))) * exp(Float64(Float64(m - n) + Float64(Float64(t_1 * Float64(n + t_1)) - l)))); elseif (m <= 8.5e-198) tmp = t_0; else tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-(M ^ 2.0)); t_1 = (m * 0.5) - M; tmp = 0.0; if (m <= -0.00185) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (m <= -9e-220) tmp = t_0; elseif (m <= -9.8e-247) tmp = cos(((m + n) * (0.5 * K))) * exp(((m - n) + ((t_1 * (n + t_1)) - l))); elseif (m <= 8.5e-198) tmp = t_0; else tmp = cos(M) * exp((m * (M - (n * 0.5)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]}, If[LessEqual[m, -0.00185], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -9e-220], t$95$0, If[LessEqual[m, -9.8e-247], N[(N[Cos[N[(N[(m + n), $MachinePrecision] * N[(0.5 * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - n), $MachinePrecision] + N[(N[(t$95$1 * N[(n + t$95$1), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 8.5e-198], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-{M}^{2}}\\
t_1 := m \cdot 0.5 - M\\
\mathbf{if}\;m \leq -0.00185:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -9 \cdot 10^{-220}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;m \leq -9.8 \cdot 10^{-247}:\\
\;\;\;\;\cos \left(\left(m + n\right) \cdot \left(0.5 \cdot K\right)\right) \cdot e^{\left(m - n\right) + \left(t\_1 \cdot \left(n + t\_1\right) - \ell\right)}\\
\mathbf{elif}\;m \leq 8.5 \cdot 10^{-198}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < -0.0018500000000000001Initial program 72.6%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in m around inf 95.2%
if -0.0018500000000000001 < m < -8.99999999999999934e-220 or -9.8e-247 < m < 8.4999999999999994e-198Initial program 91.1%
Taylor expanded in K around 0 94.7%
cos-neg94.7%
Simplified94.7%
Taylor expanded in M around inf 63.4%
mul-1-neg63.4%
Simplified63.4%
if -8.99999999999999934e-220 < m < -9.8e-247Initial program 100.0%
*-un-lft-identity100.0%
*-commutative100.0%
Applied egg-rr15.6%
*-rgt-identity15.6%
Simplified15.6%
add-exp-log15.0%
Applied egg-rr15.0%
Taylor expanded in n around 0 29.0%
+-commutative29.0%
unpow229.0%
distribute-rgt-out29.0%
*-commutative29.0%
*-commutative29.0%
Simplified29.0%
Taylor expanded in M around 0 71.9%
*-commutative71.9%
*-commutative71.9%
associate-*l*71.9%
Simplified71.9%
if 8.4999999999999994e-198 < m Initial program 73.3%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in m around 0 75.0%
+-commutative75.0%
unpow275.0%
distribute-rgt-out82.4%
*-commutative82.4%
*-commutative82.4%
Simplified82.4%
Taylor expanded in m around inf 51.5%
Final simplification65.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (* n 0.5) M))
(t_1 (- (* m 0.5) M))
(t_2 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= M -26.5)
t_2
(if (<= M -1.02e-270)
(* (cos M) (exp (+ (* t_0 (+ m t_0)) (- (- m n) l))))
(if (<= M 1.6e-15)
(* (exp (+ (- m n) (- (* t_1 (+ n t_1)) l))) (cos (- M)))
t_2)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (n * 0.5) - M;
double t_1 = (m * 0.5) - M;
double t_2 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (M <= -26.5) {
tmp = t_2;
} else if (M <= -1.02e-270) {
tmp = cos(M) * exp(((t_0 * (m + t_0)) + ((m - n) - l)));
} else if (M <= 1.6e-15) {
tmp = exp(((m - n) + ((t_1 * (n + t_1)) - l))) * cos(-M);
} else {
tmp = t_2;
}
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) :: t_2
real(8) :: tmp
t_0 = (n * 0.5d0) - m_1
t_1 = (m * 0.5d0) - m_1
t_2 = cos(m_1) * exp(-(m_1 ** 2.0d0))
if (m_1 <= (-26.5d0)) then
tmp = t_2
else if (m_1 <= (-1.02d-270)) then
tmp = cos(m_1) * exp(((t_0 * (m + t_0)) + ((m - n) - l)))
else if (m_1 <= 1.6d-15) then
tmp = exp(((m - n) + ((t_1 * (n + t_1)) - l))) * cos(-m_1)
else
tmp = t_2
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (n * 0.5) - M;
double t_1 = (m * 0.5) - M;
double t_2 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double tmp;
if (M <= -26.5) {
tmp = t_2;
} else if (M <= -1.02e-270) {
tmp = Math.cos(M) * Math.exp(((t_0 * (m + t_0)) + ((m - n) - l)));
} else if (M <= 1.6e-15) {
tmp = Math.exp(((m - n) + ((t_1 * (n + t_1)) - l))) * Math.cos(-M);
} else {
tmp = t_2;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (n * 0.5) - M t_1 = (m * 0.5) - M t_2 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if M <= -26.5: tmp = t_2 elif M <= -1.02e-270: tmp = math.cos(M) * math.exp(((t_0 * (m + t_0)) + ((m - n) - l))) elif M <= 1.6e-15: tmp = math.exp(((m - n) + ((t_1 * (n + t_1)) - l))) * math.cos(-M) else: tmp = t_2 return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(n * 0.5) - M) t_1 = Float64(Float64(m * 0.5) - M) t_2 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (M <= -26.5) tmp = t_2; elseif (M <= -1.02e-270) tmp = Float64(cos(M) * exp(Float64(Float64(t_0 * Float64(m + t_0)) + Float64(Float64(m - n) - l)))); elseif (M <= 1.6e-15) tmp = Float64(exp(Float64(Float64(m - n) + Float64(Float64(t_1 * Float64(n + t_1)) - l))) * cos(Float64(-M))); else tmp = t_2; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (n * 0.5) - M; t_1 = (m * 0.5) - M; t_2 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (M <= -26.5) tmp = t_2; elseif (M <= -1.02e-270) tmp = cos(M) * exp(((t_0 * (m + t_0)) + ((m - n) - l))); elseif (M <= 1.6e-15) tmp = exp(((m - n) + ((t_1 * (n + t_1)) - l))) * cos(-M); else tmp = t_2; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision]}, Block[{t$95$1 = N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -26.5], t$95$2, If[LessEqual[M, -1.02e-270], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 * N[(m + t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.6e-15], N[(N[Exp[N[(N[(m - n), $MachinePrecision] + N[(N[(t$95$1 * N[(n + t$95$1), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[(-M)], $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot 0.5 - M\\
t_1 := m \cdot 0.5 - M\\
t_2 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;M \leq -26.5:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;M \leq -1.02 \cdot 10^{-270}:\\
\;\;\;\;\cos M \cdot e^{t\_0 \cdot \left(m + t\_0\right) + \left(\left(m - n\right) - \ell\right)}\\
\mathbf{elif}\;M \leq 1.6 \cdot 10^{-15}:\\
\;\;\;\;e^{\left(m - n\right) + \left(t\_1 \cdot \left(n + t\_1\right) - \ell\right)} \cdot \cos \left(-M\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if M < -26.5 or 1.6e-15 < M Initial program 83.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 97.0%
mul-1-neg97.0%
Simplified97.0%
if -26.5 < M < -1.02e-270Initial program 76.9%
Taylor expanded in K around 0 93.5%
cos-neg93.5%
Simplified93.5%
Taylor expanded in m around 0 72.4%
+-commutative72.4%
unpow272.4%
distribute-rgt-out76.2%
*-commutative76.2%
*-commutative76.2%
Simplified76.2%
add-cube-cbrt76.2%
pow376.2%
associate--r-76.2%
distribute-rgt-neg-in76.2%
+-commutative76.2%
Applied egg-rr76.2%
rem-cube-cbrt76.2%
associate-+l-76.2%
add-sqr-sqrt36.9%
sqrt-unprod51.6%
sqr-neg51.6%
sqrt-unprod12.8%
add-sqr-sqrt17.5%
+-commutative17.5%
add-sqr-sqrt13.2%
fabs-sqr13.2%
add-sqr-sqrt23.2%
Applied egg-rr23.2%
if -1.02e-270 < M < 1.6e-15Initial program 71.2%
*-un-lft-identity71.2%
*-commutative71.2%
Applied egg-rr27.3%
*-rgt-identity27.3%
Simplified27.3%
add-exp-log16.1%
Applied egg-rr16.1%
Taylor expanded in n around 0 24.1%
+-commutative24.1%
unpow224.1%
distribute-rgt-out24.1%
*-commutative24.1%
*-commutative24.1%
Simplified24.1%
Taylor expanded in K around 0 51.1%
Final simplification68.7%
(FPCore (K m n M l)
:precision binary64
(if (<= n 3.05e-232)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 2.9e-6)
(* (cos M) (exp (- (pow M 2.0))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 3.05e-232) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 2.9e-6) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (n <= 3.05d-232) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (n <= 2.9d-6) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 3.05e-232) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 2.9e-6) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 3.05e-232: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 2.9e-6: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 3.05e-232) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 2.9e-6) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 3.05e-232) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (n <= 2.9e-6) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 3.05e-232], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 2.9e-6], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 3.05 \cdot 10^{-232}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 2.9 \cdot 10^{-6}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 3.0500000000000001e-232Initial program 79.7%
Taylor expanded in K around 0 94.4%
cos-neg94.4%
Simplified94.4%
Taylor expanded in m around inf 53.3%
if 3.0500000000000001e-232 < n < 2.9000000000000002e-6Initial program 80.4%
Taylor expanded in K around 0 94.5%
cos-neg94.5%
Simplified94.5%
Taylor expanded in M around inf 67.4%
mul-1-neg67.4%
Simplified67.4%
if 2.9000000000000002e-6 < n Initial program 74.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around inf 97.4%
Final simplification69.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (* m 0.5) M)))
(if (<= l -4.7e+228)
(* (cos (* (+ m n) (* 0.5 K))) (exp (+ (- m n) (- (* t_0 (+ n t_0)) l))))
(if (<= l 2.5e-7) (* (cos M) (exp (* m (- M (* n 0.5))))) (exp (- l))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m * 0.5) - M;
double tmp;
if (l <= -4.7e+228) {
tmp = cos(((m + n) * (0.5 * K))) * exp(((m - n) + ((t_0 * (n + t_0)) - l)));
} else if (l <= 2.5e-7) {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
} 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) :: t_0
real(8) :: tmp
t_0 = (m * 0.5d0) - m_1
if (l <= (-4.7d+228)) then
tmp = cos(((m + n) * (0.5d0 * k))) * exp(((m - n) + ((t_0 * (n + t_0)) - l)))
else if (l <= 2.5d-7) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
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 t_0 = (m * 0.5) - M;
double tmp;
if (l <= -4.7e+228) {
tmp = Math.cos(((m + n) * (0.5 * K))) * Math.exp(((m - n) + ((t_0 * (n + t_0)) - l)));
} else if (l <= 2.5e-7) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (m * 0.5) - M tmp = 0 if l <= -4.7e+228: tmp = math.cos(((m + n) * (0.5 * K))) * math.exp(((m - n) + ((t_0 * (n + t_0)) - l))) elif l <= 2.5e-7: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(m * 0.5) - M) tmp = 0.0 if (l <= -4.7e+228) tmp = Float64(cos(Float64(Float64(m + n) * Float64(0.5 * K))) * exp(Float64(Float64(m - n) + Float64(Float64(t_0 * Float64(n + t_0)) - l)))); elseif (l <= 2.5e-7) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (m * 0.5) - M; tmp = 0.0; if (l <= -4.7e+228) tmp = cos(((m + n) * (0.5 * K))) * exp(((m - n) + ((t_0 * (n + t_0)) - l))); elseif (l <= 2.5e-7) tmp = cos(M) * exp((m * (M - (n * 0.5)))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]}, If[LessEqual[l, -4.7e+228], N[(N[Cos[N[(N[(m + n), $MachinePrecision] * N[(0.5 * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - n), $MachinePrecision] + N[(N[(t$95$0 * N[(n + t$95$0), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.5e-7], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := m \cdot 0.5 - M\\
\mathbf{if}\;\ell \leq -4.7 \cdot 10^{+228}:\\
\;\;\;\;\cos \left(\left(m + n\right) \cdot \left(0.5 \cdot K\right)\right) \cdot e^{\left(m - n\right) + \left(t\_0 \cdot \left(n + t\_0\right) - \ell\right)}\\
\mathbf{elif}\;\ell \leq 2.5 \cdot 10^{-7}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -4.7e228Initial program 92.9%
*-un-lft-identity92.9%
*-commutative92.9%
Applied egg-rr50.7%
*-rgt-identity50.7%
Simplified50.7%
add-exp-log21.8%
Applied egg-rr21.8%
Taylor expanded in n around 0 28.7%
+-commutative28.7%
unpow228.7%
distribute-rgt-out28.8%
*-commutative28.8%
*-commutative28.8%
Simplified28.8%
Taylor expanded in M around 0 64.7%
*-commutative64.7%
*-commutative64.7%
associate-*l*64.7%
Simplified64.7%
if -4.7e228 < l < 2.49999999999999989e-7Initial program 78.3%
Taylor expanded in K around 0 95.6%
cos-neg95.6%
Simplified95.6%
Taylor expanded in m around 0 74.7%
+-commutative74.7%
unpow274.7%
distribute-rgt-out81.9%
*-commutative81.9%
*-commutative81.9%
Simplified81.9%
Taylor expanded in m around inf 46.6%
if 2.49999999999999989e-7 < l Initial program 75.4%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 98.4%
neg-mul-198.4%
Simplified98.4%
Taylor expanded in M around 0 98.4%
Final simplification59.9%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- (* n 0.5) M)))
(if (<= l -1.8e+248)
(* (cos M) (exp (+ (* t_0 (+ m t_0)) (- (- m n) l))))
(if (<= l 2.5e-7) (* (cos M) (exp (* m (- M (* n 0.5))))) (exp (- l))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (n * 0.5) - M;
double tmp;
if (l <= -1.8e+248) {
tmp = cos(M) * exp(((t_0 * (m + t_0)) + ((m - n) - l)));
} else if (l <= 2.5e-7) {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
} 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) :: t_0
real(8) :: tmp
t_0 = (n * 0.5d0) - m_1
if (l <= (-1.8d+248)) then
tmp = cos(m_1) * exp(((t_0 * (m + t_0)) + ((m - n) - l)))
else if (l <= 2.5d-7) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
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 t_0 = (n * 0.5) - M;
double tmp;
if (l <= -1.8e+248) {
tmp = Math.cos(M) * Math.exp(((t_0 * (m + t_0)) + ((m - n) - l)));
} else if (l <= 2.5e-7) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (n * 0.5) - M tmp = 0 if l <= -1.8e+248: tmp = math.cos(M) * math.exp(((t_0 * (m + t_0)) + ((m - n) - l))) elif l <= 2.5e-7: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(n * 0.5) - M) tmp = 0.0 if (l <= -1.8e+248) tmp = Float64(cos(M) * exp(Float64(Float64(t_0 * Float64(m + t_0)) + Float64(Float64(m - n) - l)))); elseif (l <= 2.5e-7) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (n * 0.5) - M; tmp = 0.0; if (l <= -1.8e+248) tmp = cos(M) * exp(((t_0 * (m + t_0)) + ((m - n) - l))); elseif (l <= 2.5e-7) tmp = cos(M) * exp((m * (M - (n * 0.5)))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision]}, If[LessEqual[l, -1.8e+248], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 * N[(m + t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.5e-7], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := n \cdot 0.5 - M\\
\mathbf{if}\;\ell \leq -1.8 \cdot 10^{+248}:\\
\;\;\;\;\cos M \cdot e^{t\_0 \cdot \left(m + t\_0\right) + \left(\left(m - n\right) - \ell\right)}\\
\mathbf{elif}\;\ell \leq 2.5 \cdot 10^{-7}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -1.80000000000000001e248Initial program 90.9%
Taylor expanded in K around 0 90.9%
cos-neg90.9%
Simplified90.9%
Taylor expanded in m around 0 82.0%
+-commutative82.0%
unpow282.0%
distribute-rgt-out82.0%
*-commutative82.0%
*-commutative82.0%
Simplified82.0%
add-cube-cbrt82.0%
pow382.0%
associate--r-82.0%
distribute-rgt-neg-in82.0%
+-commutative82.0%
Applied egg-rr82.0%
rem-cube-cbrt82.0%
associate-+l-82.0%
add-sqr-sqrt36.5%
sqrt-unprod64.1%
sqr-neg64.1%
sqrt-unprod27.6%
add-sqr-sqrt46.2%
+-commutative46.2%
add-sqr-sqrt18.5%
fabs-sqr18.5%
add-sqr-sqrt46.2%
Applied egg-rr46.2%
if -1.80000000000000001e248 < l < 2.49999999999999989e-7Initial program 78.6%
Taylor expanded in K around 0 95.1%
cos-neg95.1%
Simplified95.1%
Taylor expanded in m around 0 74.6%
+-commutative74.6%
unpow274.6%
distribute-rgt-out81.6%
*-commutative81.6%
*-commutative81.6%
Simplified81.6%
Taylor expanded in m around inf 45.9%
if 2.49999999999999989e-7 < l Initial program 75.4%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 98.4%
neg-mul-198.4%
Simplified98.4%
Taylor expanded in M around 0 98.4%
Final simplification58.4%
(FPCore (K m n M l) :precision binary64 (if (<= l 2.5e-7) (* (cos M) (exp (* m (- M (* n 0.5))))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 2.5e-7) {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
} 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 <= 2.5d-7) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
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 <= 2.5e-7) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 2.5e-7: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 2.5e-7) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 2.5e-7) tmp = cos(M) * exp((m * (M - (n * 0.5)))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 2.5e-7], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 2.5 \cdot 10^{-7}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 2.49999999999999989e-7Initial program 79.3%
Taylor expanded in K around 0 94.9%
cos-neg94.9%
Simplified94.9%
Taylor expanded in m around 0 75.0%
+-commutative75.0%
unpow275.0%
distribute-rgt-out81.7%
*-commutative81.7%
*-commutative81.7%
Simplified81.7%
Taylor expanded in m around inf 44.9%
if 2.49999999999999989e-7 < l Initial program 75.4%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 98.4%
neg-mul-198.4%
Simplified98.4%
Taylor expanded in M around 0 98.4%
Final simplification57.7%
(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 78.4%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in l around inf 32.5%
neg-mul-132.5%
Simplified32.5%
Final simplification32.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 78.4%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in l around inf 32.5%
neg-mul-132.5%
Simplified32.5%
Taylor expanded in M around 0 32.5%
Final simplification32.5%
(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 78.4%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in l around inf 32.5%
neg-mul-132.5%
Simplified32.5%
Taylor expanded in l around 0 6.9%
Final simplification6.9%
herbie shell --seed 2024075
(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)))))))