
(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 13 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (fabs (- n m)) (+ (pow (- (/ (+ m n) 2.0) M) 2.0) l)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((fabs((n - m)) - (pow((((m + n) / 2.0) - M), 2.0) + 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((abs((n - m)) - (((((m + n) / 2.0d0) - m_1) ** 2.0d0) + l)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((Math.abs((n - m)) - (Math.pow((((m + n) / 2.0) - M), 2.0) + l)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((math.fabs((n - m)) - (math.pow((((m + n) / 2.0) - M), 2.0) + l)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(abs(Float64(n - m)) - Float64((Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0) + l)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((abs((n - m)) - (((((m + n) / 2.0) - M) ^ 2.0) + l))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left|n - m\right| - \left({\left(\frac{m + n}{2} - M\right)}^{2} + \ell\right)}
\end{array}
Initial program 79.0%
associate-/l*79.4%
exp-diff24.7%
sub-neg24.7%
exp-sum18.0%
associate-/r*18.0%
exp-diff24.7%
exp-diff79.4%
sub-neg79.4%
remove-double-neg79.4%
fabs-sub79.4%
Simplified79.4%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= n 5e+123)
(* (cos M) (exp (+ t_0 (- (* (- (* m 0.5) M) (- (- M (* m 0.5)) n)) l))))
(* (cos M) (exp (- t_0 (+ (* (* n 0.5) (+ m (* n 0.5))) l)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (n <= 5e+123) {
tmp = cos(M) * exp((t_0 + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l)));
} else {
tmp = cos(M) * exp((t_0 - (((n * 0.5) * (m + (n * 0.5))) + 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 = abs((n - m))
if (n <= 5d+123) then
tmp = cos(m_1) * exp((t_0 + ((((m * 0.5d0) - m_1) * ((m_1 - (m * 0.5d0)) - n)) - l)))
else
tmp = cos(m_1) * exp((t_0 - (((n * 0.5d0) * (m + (n * 0.5d0))) + l)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.abs((n - m));
double tmp;
if (n <= 5e+123) {
tmp = Math.cos(M) * Math.exp((t_0 + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l)));
} else {
tmp = Math.cos(M) * Math.exp((t_0 - (((n * 0.5) * (m + (n * 0.5))) + l)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if n <= 5e+123: tmp = math.cos(M) * math.exp((t_0 + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l))) else: tmp = math.cos(M) * math.exp((t_0 - (((n * 0.5) * (m + (n * 0.5))) + l))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (n <= 5e+123) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - Float64(m * 0.5)) - n)) - l)))); else tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(Float64(Float64(n * 0.5) * Float64(m + Float64(n * 0.5))) + l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (n <= 5e+123) tmp = cos(M) * exp((t_0 + ((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) - l))); else tmp = cos(M) * exp((t_0 - (((n * 0.5) * (m + (n * 0.5))) + l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, 5e+123], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(N[(N[(n * 0.5), $MachinePrecision] * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;n \leq 5 \cdot 10^{+123}:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - m \cdot 0.5\right) - n\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(\left(n \cdot 0.5\right) \cdot \left(m + n \cdot 0.5\right) + \ell\right)}\\
\end{array}
\end{array}
if n < 4.99999999999999974e123Initial program 80.1%
associate-/l*80.5%
exp-diff28.9%
sub-neg28.9%
exp-sum21.5%
associate-/r*21.5%
exp-diff29.4%
exp-diff80.5%
sub-neg80.5%
remove-double-neg80.5%
fabs-sub80.5%
Simplified80.5%
Taylor expanded in K around 0 97.7%
cos-neg97.7%
Simplified97.7%
Taylor expanded in n around 0 84.3%
+-commutative84.3%
unpow284.3%
distribute-rgt-out87.6%
*-commutative87.6%
*-commutative87.6%
Simplified87.6%
if 4.99999999999999974e123 < n Initial program 73.2%
associate-/l*73.2%
exp-diff2.4%
sub-neg2.4%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
exp-diff73.2%
sub-neg73.2%
remove-double-neg73.2%
fabs-sub73.2%
Simplified73.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around 0 82.9%
+-commutative82.9%
unpow282.9%
distribute-rgt-out97.6%
*-commutative97.6%
*-commutative97.6%
Simplified97.6%
Taylor expanded in M around 0 97.6%
associate-*r*97.6%
*-commutative97.6%
*-commutative97.6%
Simplified97.6%
Final simplification89.2%
(FPCore (K m n M l)
:precision binary64
(if (<= m -1.3e+73)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(cos M)
(exp (+ (fabs (- n m)) (- (* (+ m (- (* n 0.5) M)) (- M (* n 0.5))) l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1.3e+73) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp((fabs((n - m)) + (((m + ((n * 0.5) - M)) * (M - (n * 0.5))) - 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.3d+73)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp((abs((n - m)) + (((m + ((n * 0.5d0) - m_1)) * (m_1 - (n * 0.5d0))) - 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.3e+73) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp((Math.abs((n - m)) + (((m + ((n * 0.5) - M)) * (M - (n * 0.5))) - l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -1.3e+73: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp((math.fabs((n - m)) + (((m + ((n * 0.5) - M)) * (M - (n * 0.5))) - l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -1.3e+73) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(abs(Float64(n - m)) + Float64(Float64(Float64(m + Float64(Float64(n * 0.5) - M)) * Float64(M - Float64(n * 0.5))) - l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -1.3e+73) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp((abs((n - m)) + (((m + ((n * 0.5) - M)) * (M - (n * 0.5))) - l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -1.3e+73], 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[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(m + N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.3 \cdot 10^{+73}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left|n - m\right| + \left(\left(m + \left(n \cdot 0.5 - M\right)\right) \cdot \left(M - n \cdot 0.5\right) - \ell\right)}\\
\end{array}
\end{array}
if m < -1.3e73Initial program 78.6%
associate-/l*78.6%
exp-diff11.9%
sub-neg11.9%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
exp-diff78.6%
sub-neg78.6%
remove-double-neg78.6%
fabs-sub78.6%
Simplified78.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 85.9%
+-commutative85.9%
unpow285.9%
distribute-rgt-out88.3%
*-commutative88.3%
*-commutative88.3%
Simplified88.3%
Taylor expanded in m around inf 100.0%
if -1.3e73 < m Initial program 79.1%
associate-/l*79.5%
exp-diff27.2%
sub-neg27.2%
exp-sum21.6%
associate-/r*21.6%
exp-diff29.5%
exp-diff79.5%
sub-neg79.5%
remove-double-neg79.5%
fabs-sub79.5%
Simplified79.5%
Taylor expanded in K around 0 97.7%
cos-neg97.7%
Simplified97.7%
Taylor expanded in m around 0 79.6%
+-commutative79.6%
unpow279.6%
distribute-rgt-out84.8%
*-commutative84.8%
*-commutative84.8%
Simplified84.8%
Final simplification87.3%
(FPCore (K m n M l) :precision binary64 (if (<= m -13200000.0) (* (cos M) (exp (* -0.25 (pow m 2.0)))) (* (cos M) (exp (- (fabs (- n m)) (+ (* (* n 0.5) (+ m (* n 0.5))) l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -13200000.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp((fabs((n - m)) - (((n * 0.5) * (m + (n * 0.5))) + 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 <= (-13200000.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp((abs((n - m)) - (((n * 0.5d0) * (m + (n * 0.5d0))) + 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 <= -13200000.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp((Math.abs((n - m)) - (((n * 0.5) * (m + (n * 0.5))) + l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -13200000.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp((math.fabs((n - m)) - (((n * 0.5) * (m + (n * 0.5))) + l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -13200000.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(abs(Float64(n - m)) - Float64(Float64(Float64(n * 0.5) * Float64(m + Float64(n * 0.5))) + l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -13200000.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp((abs((n - m)) - (((n * 0.5) * (m + (n * 0.5))) + l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -13200000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(N[(N[(n * 0.5), $MachinePrecision] * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -13200000:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left|n - m\right| - \left(\left(n \cdot 0.5\right) \cdot \left(m + n \cdot 0.5\right) + \ell\right)}\\
\end{array}
\end{array}
if m < -1.32e7Initial program 79.3%
associate-/l*79.3%
exp-diff12.1%
sub-neg12.1%
exp-sum0.0%
associate-/r*0.0%
exp-diff3.4%
exp-diff79.3%
sub-neg79.3%
remove-double-neg79.3%
fabs-sub79.3%
Simplified79.3%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 86.3%
+-commutative86.3%
unpow286.3%
distribute-rgt-out89.8%
*-commutative89.8%
*-commutative89.8%
Simplified89.8%
Taylor expanded in m around inf 94.9%
if -1.32e7 < m Initial program 78.9%
associate-/l*79.4%
exp-diff28.4%
sub-neg28.4%
exp-sum23.3%
associate-/r*23.3%
exp-diff30.9%
exp-diff79.4%
sub-neg79.4%
remove-double-neg79.4%
fabs-sub79.4%
Simplified79.4%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in m around 0 80.0%
+-commutative80.0%
unpow280.0%
distribute-rgt-out84.6%
*-commutative84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in M around 0 62.8%
associate-*r*62.8%
*-commutative62.8%
*-commutative62.8%
Simplified62.8%
Final simplification70.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* -0.25 (pow m 2.0)))))
(t_1 (* (cos M) (exp (- (pow M 2.0)))))
(t_2 (exp (- l))))
(if (<= M -27.0)
t_1
(if (<= M 1.8e-272)
t_0
(if (<= M 5.8e-133)
t_2
(if (<= M 4.6e-61)
t_0
(if (<= M 27.0) (* t_2 (cos (- (/ K (/ 2.0 n)) M))) t_1)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((-0.25 * pow(m, 2.0)));
double t_1 = cos(M) * exp(-pow(M, 2.0));
double t_2 = exp(-l);
double tmp;
if (M <= -27.0) {
tmp = t_1;
} else if (M <= 1.8e-272) {
tmp = t_0;
} else if (M <= 5.8e-133) {
tmp = t_2;
} else if (M <= 4.6e-61) {
tmp = t_0;
} else if (M <= 27.0) {
tmp = t_2 * cos(((K / (2.0 / n)) - M));
} else {
tmp = t_1;
}
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 = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
t_1 = cos(m_1) * exp(-(m_1 ** 2.0d0))
t_2 = exp(-l)
if (m_1 <= (-27.0d0)) then
tmp = t_1
else if (m_1 <= 1.8d-272) then
tmp = t_0
else if (m_1 <= 5.8d-133) then
tmp = t_2
else if (m_1 <= 4.6d-61) then
tmp = t_0
else if (m_1 <= 27.0d0) then
tmp = t_2 * cos(((k / (2.0d0 / n)) - m_1))
else
tmp = t_1
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
double t_1 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double t_2 = Math.exp(-l);
double tmp;
if (M <= -27.0) {
tmp = t_1;
} else if (M <= 1.8e-272) {
tmp = t_0;
} else if (M <= 5.8e-133) {
tmp = t_2;
} else if (M <= 4.6e-61) {
tmp = t_0;
} else if (M <= 27.0) {
tmp = t_2 * Math.cos(((K / (2.0 / n)) - M));
} else {
tmp = t_1;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) t_1 = math.cos(M) * math.exp(-math.pow(M, 2.0)) t_2 = math.exp(-l) tmp = 0 if M <= -27.0: tmp = t_1 elif M <= 1.8e-272: tmp = t_0 elif M <= 5.8e-133: tmp = t_2 elif M <= 4.6e-61: tmp = t_0 elif M <= 27.0: tmp = t_2 * math.cos(((K / (2.0 / n)) - M)) else: tmp = t_1 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))) t_1 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) t_2 = exp(Float64(-l)) tmp = 0.0 if (M <= -27.0) tmp = t_1; elseif (M <= 1.8e-272) tmp = t_0; elseif (M <= 5.8e-133) tmp = t_2; elseif (M <= 4.6e-61) tmp = t_0; elseif (M <= 27.0) tmp = Float64(t_2 * cos(Float64(Float64(K / Float64(2.0 / n)) - M))); else tmp = t_1; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp((-0.25 * (m ^ 2.0))); t_1 = cos(M) * exp(-(M ^ 2.0)); t_2 = exp(-l); tmp = 0.0; if (M <= -27.0) tmp = t_1; elseif (M <= 1.8e-272) tmp = t_0; elseif (M <= 5.8e-133) tmp = t_2; elseif (M <= 4.6e-61) tmp = t_0; elseif (M <= 27.0) tmp = t_2 * cos(((K / (2.0 / n)) - M)); else tmp = t_1; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[M, -27.0], t$95$1, If[LessEqual[M, 1.8e-272], t$95$0, If[LessEqual[M, 5.8e-133], t$95$2, If[LessEqual[M, 4.6e-61], t$95$0, If[LessEqual[M, 27.0], N[(t$95$2 * N[Cos[N[(N[(K / N[(2.0 / n), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
t_1 := \cos M \cdot e^{-{M}^{2}}\\
t_2 := e^{-\ell}\\
\mathbf{if}\;M \leq -27:\\
\;\;\;\;t_1\\
\mathbf{elif}\;M \leq 1.8 \cdot 10^{-272}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;M \leq 5.8 \cdot 10^{-133}:\\
\;\;\;\;t_2\\
\mathbf{elif}\;M \leq 4.6 \cdot 10^{-61}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;M \leq 27:\\
\;\;\;\;t_2 \cdot \cos \left(\frac{K}{\frac{2}{n}} - M\right)\\
\mathbf{else}:\\
\;\;\;\;t_1\\
\end{array}
\end{array}
if M < -27 or 27 < M Initial program 83.1%
associate-/l*83.1%
exp-diff25.4%
sub-neg25.4%
exp-sum20.0%
associate-/r*20.0%
exp-diff28.5%
exp-diff83.1%
sub-neg83.1%
remove-double-neg83.1%
fabs-sub83.1%
Simplified83.1%
Taylor expanded in K around 0 99.2%
cos-neg99.2%
Simplified99.2%
Taylor expanded in n around 0 89.3%
+-commutative89.3%
unpow289.3%
distribute-rgt-out94.7%
*-commutative94.7%
*-commutative94.7%
Simplified94.7%
Taylor expanded in M around inf 96.2%
mul-1-neg96.2%
Simplified96.2%
if -27 < M < 1.79999999999999984e-272 or 5.7999999999999997e-133 < M < 4.59999999999999984e-61Initial program 74.0%
associate-/l*74.0%
exp-diff18.0%
sub-neg18.0%
exp-sum10.9%
associate-/r*10.9%
exp-diff13.3%
exp-diff74.0%
sub-neg74.0%
remove-double-neg74.0%
fabs-sub74.0%
Simplified74.0%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in n around 0 64.8%
+-commutative64.8%
unpow264.8%
distribute-rgt-out68.3%
*-commutative68.3%
*-commutative68.3%
Simplified68.3%
Taylor expanded in m around inf 65.3%
if 1.79999999999999984e-272 < M < 5.7999999999999997e-133Initial program 76.9%
associate-/l*80.8%
exp-diff34.6%
sub-neg34.6%
exp-sum30.8%
associate-/r*30.8%
exp-diff38.5%
exp-diff80.8%
sub-neg80.8%
remove-double-neg80.8%
fabs-sub80.8%
Simplified80.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 58.3%
+-commutative58.3%
unpow258.3%
distribute-rgt-out58.4%
*-commutative58.4%
*-commutative58.4%
Simplified58.4%
Taylor expanded in l around inf 73.9%
neg-mul-173.9%
Simplified73.9%
Taylor expanded in M around 0 73.9%
if 4.59999999999999984e-61 < M < 27Initial program 75.1%
associate-/l*75.1%
exp-diff37.6%
sub-neg37.6%
exp-sum18.8%
associate-/r*18.8%
exp-diff31.3%
exp-diff75.1%
sub-neg75.1%
remove-double-neg75.1%
fabs-sub75.1%
Simplified75.1%
Taylor expanded in n around 0 56.6%
+-commutative63.0%
unpow263.0%
distribute-rgt-out63.0%
*-commutative63.0%
*-commutative63.0%
Simplified56.6%
Taylor expanded in m around 0 50.5%
associate-*r*50.5%
neg-mul-150.5%
Simplified50.5%
Taylor expanded in m around 0 50.7%
Taylor expanded in l around inf 63.3%
neg-mul-163.3%
Simplified63.3%
Final simplification81.8%
(FPCore (K m n M l) :precision binary64 (if (<= M -1.8e-119) (* (cos M) (exp (* M (- n M)))) (if (<= M 1.65e+20) (/ (cos M) (exp l)) (* (cos M) (exp (- (pow M 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -1.8e-119) {
tmp = cos(M) * exp((M * (n - M)));
} else if (M <= 1.65e+20) {
tmp = cos(M) / exp(l);
} 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 <= (-1.8d-119)) then
tmp = cos(m_1) * exp((m_1 * (n - m_1)))
else if (m_1 <= 1.65d+20) then
tmp = cos(m_1) / exp(l)
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 <= -1.8e-119) {
tmp = Math.cos(M) * Math.exp((M * (n - M)));
} else if (M <= 1.65e+20) {
tmp = Math.cos(M) / Math.exp(l);
} 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 <= -1.8e-119: tmp = math.cos(M) * math.exp((M * (n - M))) elif M <= 1.65e+20: tmp = math.cos(M) / math.exp(l) 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 <= -1.8e-119) tmp = Float64(cos(M) * exp(Float64(M * Float64(n - M)))); elseif (M <= 1.65e+20) tmp = Float64(cos(M) / exp(l)); 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 <= -1.8e-119) tmp = cos(M) * exp((M * (n - M))); elseif (M <= 1.65e+20) tmp = cos(M) / exp(l); else tmp = cos(M) * exp(-(M ^ 2.0)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, -1.8e-119], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.65e+20], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $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 -1.8 \cdot 10^{-119}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(n - M\right)}\\
\mathbf{elif}\;M \leq 1.65 \cdot 10^{+20}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\end{array}
\end{array}
if M < -1.8e-119Initial program 80.0%
associate-/l*80.0%
exp-diff18.8%
sub-neg18.8%
exp-sum13.8%
associate-/r*13.8%
exp-diff21.3%
exp-diff80.0%
sub-neg80.0%
remove-double-neg80.0%
fabs-sub80.0%
Simplified80.0%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in n around 0 83.9%
+-commutative83.9%
unpow283.9%
distribute-rgt-out88.9%
*-commutative88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in M around -inf 63.0%
+-commutative63.0%
mul-1-neg63.0%
unsub-neg63.0%
+-commutative63.0%
Simplified63.0%
Taylor expanded in m around 0 69.4%
unpow269.4%
distribute-lft-out--71.9%
Simplified71.9%
if -1.8e-119 < M < 1.65e20Initial program 76.3%
associate-/l*77.2%
exp-diff26.8%
sub-neg26.8%
exp-sum17.6%
associate-/r*17.6%
exp-diff24.0%
exp-diff77.2%
sub-neg77.2%
remove-double-neg77.2%
fabs-sub77.2%
Simplified77.2%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in n around 0 63.8%
+-commutative63.8%
unpow263.8%
distribute-rgt-out64.8%
*-commutative64.8%
*-commutative64.8%
Simplified64.8%
Taylor expanded in l around inf 53.5%
neg-mul-153.5%
Simplified53.5%
Taylor expanded in l around -inf 53.5%
rem-exp-log53.5%
neg-mul-153.5%
exp-sum53.5%
unsub-neg53.5%
exp-diff53.5%
rem-exp-log53.5%
Simplified53.5%
if 1.65e20 < M Initial program 82.1%
associate-/l*82.1%
exp-diff28.4%
sub-neg28.4%
exp-sum23.9%
associate-/r*23.9%
exp-diff29.9%
exp-diff82.1%
sub-neg82.1%
remove-double-neg82.1%
fabs-sub82.1%
Simplified82.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 88.1%
+-commutative88.1%
unpow288.1%
distribute-rgt-out95.6%
*-commutative95.6%
*-commutative95.6%
Simplified95.6%
Taylor expanded in M around inf 98.5%
mul-1-neg98.5%
Simplified98.5%
Final simplification71.0%
(FPCore (K m n M l) :precision binary64 (if (<= M -7.6e-119) (* (cos M) (exp (* M (- n M)))) (if (<= M 8e+29) (/ (cos M) (exp l)) (* (cos M) (exp (* M (- m M)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -7.6e-119) {
tmp = cos(M) * exp((M * (n - M)));
} else if (M <= 8e+29) {
tmp = cos(M) / exp(l);
} else {
tmp = cos(M) * exp((M * (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 <= (-7.6d-119)) then
tmp = cos(m_1) * exp((m_1 * (n - m_1)))
else if (m_1 <= 8d+29) then
tmp = cos(m_1) / exp(l)
else
tmp = cos(m_1) * exp((m_1 * (m - m_1)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -7.6e-119) {
tmp = Math.cos(M) * Math.exp((M * (n - M)));
} else if (M <= 8e+29) {
tmp = Math.cos(M) / Math.exp(l);
} else {
tmp = Math.cos(M) * Math.exp((M * (m - M)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= -7.6e-119: tmp = math.cos(M) * math.exp((M * (n - M))) elif M <= 8e+29: tmp = math.cos(M) / math.exp(l) else: tmp = math.cos(M) * math.exp((M * (m - M))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= -7.6e-119) tmp = Float64(cos(M) * exp(Float64(M * Float64(n - M)))); elseif (M <= 8e+29) tmp = Float64(cos(M) / exp(l)); else tmp = Float64(cos(M) * exp(Float64(M * Float64(m - M)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= -7.6e-119) tmp = cos(M) * exp((M * (n - M))); elseif (M <= 8e+29) tmp = cos(M) / exp(l); else tmp = cos(M) * exp((M * (m - M))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, -7.6e-119], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 8e+29], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -7.6 \cdot 10^{-119}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(n - M\right)}\\
\mathbf{elif}\;M \leq 8 \cdot 10^{+29}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(m - M\right)}\\
\end{array}
\end{array}
if M < -7.59999999999999949e-119Initial program 80.0%
associate-/l*80.0%
exp-diff18.8%
sub-neg18.8%
exp-sum13.8%
associate-/r*13.8%
exp-diff21.3%
exp-diff80.0%
sub-neg80.0%
remove-double-neg80.0%
fabs-sub80.0%
Simplified80.0%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in n around 0 83.9%
+-commutative83.9%
unpow283.9%
distribute-rgt-out88.9%
*-commutative88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in M around -inf 63.0%
+-commutative63.0%
mul-1-neg63.0%
unsub-neg63.0%
+-commutative63.0%
Simplified63.0%
Taylor expanded in m around 0 69.4%
unpow269.4%
distribute-lft-out--71.9%
Simplified71.9%
if -7.59999999999999949e-119 < M < 7.99999999999999931e29Initial program 75.6%
associate-/l*76.5%
exp-diff28.2%
sub-neg28.2%
exp-sum17.7%
associate-/r*17.7%
exp-diff23.8%
exp-diff76.5%
sub-neg76.5%
remove-double-neg76.5%
fabs-sub76.5%
Simplified76.5%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in n around 0 65.4%
+-commutative65.4%
unpow265.4%
distribute-rgt-out66.3%
*-commutative66.3%
*-commutative66.3%
Simplified66.3%
Taylor expanded in l around inf 54.7%
neg-mul-154.7%
Simplified54.7%
Taylor expanded in l around -inf 54.7%
rem-exp-log52.9%
neg-mul-152.9%
exp-sum52.9%
unsub-neg52.9%
exp-diff52.9%
rem-exp-log54.7%
Simplified54.7%
if 7.99999999999999931e29 < M Initial program 83.9%
associate-/l*83.9%
exp-diff25.8%
sub-neg25.8%
exp-sum24.2%
associate-/r*24.2%
exp-diff30.6%
exp-diff83.9%
sub-neg83.9%
remove-double-neg83.9%
fabs-sub83.9%
Simplified83.9%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 87.2%
+-commutative87.2%
unpow287.2%
distribute-rgt-out95.2%
*-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in M around -inf 66.3%
+-commutative66.3%
mul-1-neg66.3%
unsub-neg66.3%
+-commutative66.3%
Simplified66.3%
Taylor expanded in n around 0 75.9%
unpow275.9%
distribute-lft-out--84.1%
Simplified84.1%
Final simplification67.2%
(FPCore (K m n M l) :precision binary64 (if (<= M -4.55e-119) (* (cos M) (exp (* M n))) (if (<= M 2.1e+31) (/ (cos M) (exp l)) (* (cos M) (exp (* M m))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -4.55e-119) {
tmp = cos(M) * exp((M * n));
} else if (M <= 2.1e+31) {
tmp = cos(M) / exp(l);
} else {
tmp = cos(M) * exp((M * m));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m_1 <= (-4.55d-119)) then
tmp = cos(m_1) * exp((m_1 * n))
else if (m_1 <= 2.1d+31) then
tmp = cos(m_1) / exp(l)
else
tmp = cos(m_1) * exp((m_1 * 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 <= -4.55e-119) {
tmp = Math.cos(M) * Math.exp((M * n));
} else if (M <= 2.1e+31) {
tmp = Math.cos(M) / Math.exp(l);
} else {
tmp = Math.cos(M) * Math.exp((M * m));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= -4.55e-119: tmp = math.cos(M) * math.exp((M * n)) elif M <= 2.1e+31: tmp = math.cos(M) / math.exp(l) else: tmp = math.cos(M) * math.exp((M * m)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= -4.55e-119) tmp = Float64(cos(M) * exp(Float64(M * n))); elseif (M <= 2.1e+31) tmp = Float64(cos(M) / exp(l)); else tmp = Float64(cos(M) * exp(Float64(M * m))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= -4.55e-119) tmp = cos(M) * exp((M * n)); elseif (M <= 2.1e+31) tmp = cos(M) / exp(l); else tmp = cos(M) * exp((M * m)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, -4.55e-119], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 2.1e+31], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -4.55 \cdot 10^{-119}:\\
\;\;\;\;\cos M \cdot e^{M \cdot n}\\
\mathbf{elif}\;M \leq 2.1 \cdot 10^{+31}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{M \cdot m}\\
\end{array}
\end{array}
if M < -4.55e-119Initial program 80.0%
associate-/l*80.0%
exp-diff18.8%
sub-neg18.8%
exp-sum13.8%
associate-/r*13.8%
exp-diff21.3%
exp-diff80.0%
sub-neg80.0%
remove-double-neg80.0%
fabs-sub80.0%
Simplified80.0%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in n around 0 83.9%
+-commutative83.9%
unpow283.9%
distribute-rgt-out88.9%
*-commutative88.9%
*-commutative88.9%
Simplified88.9%
Taylor expanded in M around -inf 63.0%
+-commutative63.0%
mul-1-neg63.0%
unsub-neg63.0%
+-commutative63.0%
Simplified63.0%
Taylor expanded in n around inf 35.3%
if -4.55e-119 < M < 2.09999999999999979e31Initial program 75.6%
associate-/l*76.5%
exp-diff28.2%
sub-neg28.2%
exp-sum17.7%
associate-/r*17.7%
exp-diff23.8%
exp-diff76.5%
sub-neg76.5%
remove-double-neg76.5%
fabs-sub76.5%
Simplified76.5%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in n around 0 65.4%
+-commutative65.4%
unpow265.4%
distribute-rgt-out66.3%
*-commutative66.3%
*-commutative66.3%
Simplified66.3%
Taylor expanded in l around inf 54.7%
neg-mul-154.7%
Simplified54.7%
Taylor expanded in l around -inf 54.7%
rem-exp-log52.9%
neg-mul-152.9%
exp-sum52.9%
unsub-neg52.9%
exp-diff52.9%
rem-exp-log54.7%
Simplified54.7%
if 2.09999999999999979e31 < M Initial program 83.9%
associate-/l*83.9%
exp-diff25.8%
sub-neg25.8%
exp-sum24.2%
associate-/r*24.2%
exp-diff30.6%
exp-diff83.9%
sub-neg83.9%
remove-double-neg83.9%
fabs-sub83.9%
Simplified83.9%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 87.2%
+-commutative87.2%
unpow287.2%
distribute-rgt-out95.2%
*-commutative95.2%
*-commutative95.2%
Simplified95.2%
Taylor expanded in M around -inf 66.3%
+-commutative66.3%
mul-1-neg66.3%
unsub-neg66.3%
+-commutative66.3%
Simplified66.3%
Taylor expanded in m around inf 29.1%
Final simplification42.4%
(FPCore (K m n M l) :precision binary64 (if (<= l 700.0) (* (cos M) (exp (* M (- m M)))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 700.0) {
tmp = cos(M) * exp((M * (m - M)));
} 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 <= 700.0d0) then
tmp = cos(m_1) * exp((m_1 * (m - m_1)))
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 <= 700.0) {
tmp = Math.cos(M) * Math.exp((M * (m - M)));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 700.0: tmp = math.cos(M) * math.exp((M * (m - M))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 700.0) tmp = Float64(cos(M) * exp(Float64(M * Float64(m - M)))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 700.0) tmp = cos(M) * exp((M * (m - M))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 700.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 700:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(m - M\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 700Initial program 77.4%
associate-/l*77.9%
exp-diff14.7%
sub-neg14.7%
exp-sum14.7%
associate-/r*14.7%
exp-diff23.9%
exp-diff77.9%
sub-neg77.9%
remove-double-neg77.9%
fabs-sub77.9%
Simplified77.9%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in n around 0 74.9%
+-commutative74.9%
unpow274.9%
distribute-rgt-out78.7%
*-commutative78.7%
*-commutative78.7%
Simplified78.7%
Taylor expanded in M around -inf 48.5%
+-commutative48.5%
mul-1-neg48.5%
unsub-neg48.5%
+-commutative48.5%
Simplified48.5%
Taylor expanded in n around 0 50.3%
unpow250.3%
distribute-lft-out--54.7%
Simplified54.7%
if 700 < l Initial program 83.1%
associate-/l*83.1%
exp-diff50.7%
sub-neg50.7%
exp-sum26.8%
associate-/r*26.8%
exp-diff26.8%
exp-diff83.1%
sub-neg83.1%
remove-double-neg83.1%
fabs-sub83.1%
Simplified83.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 80.5%
+-commutative80.5%
unpow280.5%
distribute-rgt-out84.7%
*-commutative84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in l around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Final simplification67.2%
(FPCore (K m n M l) :precision binary64 (if (<= l 700.0) (* (cos M) (exp (* M m))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 700.0) {
tmp = cos(M) * exp((M * m));
} 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 <= 700.0d0) then
tmp = cos(m_1) * exp((m_1 * m))
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 <= 700.0) {
tmp = Math.cos(M) * Math.exp((M * m));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 700.0: tmp = math.cos(M) * math.exp((M * m)) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 700.0) tmp = Float64(cos(M) * exp(Float64(M * m))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 700.0) tmp = cos(M) * exp((M * m)); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 700.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(M * m), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 700:\\
\;\;\;\;\cos M \cdot e^{M \cdot m}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 700Initial program 77.4%
associate-/l*77.9%
exp-diff14.7%
sub-neg14.7%
exp-sum14.7%
associate-/r*14.7%
exp-diff23.9%
exp-diff77.9%
sub-neg77.9%
remove-double-neg77.9%
fabs-sub77.9%
Simplified77.9%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in n around 0 74.9%
+-commutative74.9%
unpow274.9%
distribute-rgt-out78.7%
*-commutative78.7%
*-commutative78.7%
Simplified78.7%
Taylor expanded in M around -inf 48.5%
+-commutative48.5%
mul-1-neg48.5%
unsub-neg48.5%
+-commutative48.5%
Simplified48.5%
Taylor expanded in m around inf 25.7%
if 700 < l Initial program 83.1%
associate-/l*83.1%
exp-diff50.7%
sub-neg50.7%
exp-sum26.8%
associate-/r*26.8%
exp-diff26.8%
exp-diff83.1%
sub-neg83.1%
remove-double-neg83.1%
fabs-sub83.1%
Simplified83.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 80.5%
+-commutative80.5%
unpow280.5%
distribute-rgt-out84.7%
*-commutative84.7%
*-commutative84.7%
Simplified84.7%
Taylor expanded in l around inf 100.0%
neg-mul-1100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Final simplification46.3%
(FPCore (K m n M l) :precision binary64 (/ (cos M) (exp l)))
double code(double K, double m, double n, double M, double l) {
return cos(M) / exp(l);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) / exp(l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) / Math.exp(l);
}
def code(K, m, n, M, l): return math.cos(M) / math.exp(l)
function code(K, m, n, M, l) return Float64(cos(M) / exp(l)) end
function tmp = code(K, m, n, M, l) tmp = cos(M) / exp(l); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\frac{\cos M}{e^{\ell}}
\end{array}
Initial program 79.0%
associate-/l*79.4%
exp-diff24.7%
sub-neg24.7%
exp-sum18.0%
associate-/r*18.0%
exp-diff24.7%
exp-diff79.4%
sub-neg79.4%
remove-double-neg79.4%
fabs-sub79.4%
Simplified79.4%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Taylor expanded in n around 0 76.4%
+-commutative76.4%
unpow276.4%
distribute-rgt-out80.4%
*-commutative80.4%
*-commutative80.4%
Simplified80.4%
Taylor expanded in l around inf 36.8%
neg-mul-136.8%
Simplified36.8%
Taylor expanded in l around -inf 36.8%
rem-exp-log30.1%
neg-mul-130.1%
exp-sum30.1%
unsub-neg30.1%
exp-diff30.1%
rem-exp-log36.8%
Simplified36.8%
Final simplification36.8%
(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 79.0%
associate-/l*79.4%
exp-diff24.7%
sub-neg24.7%
exp-sum18.0%
associate-/r*18.0%
exp-diff24.7%
exp-diff79.4%
sub-neg79.4%
remove-double-neg79.4%
fabs-sub79.4%
Simplified79.4%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Taylor expanded in n around 0 76.4%
+-commutative76.4%
unpow276.4%
distribute-rgt-out80.4%
*-commutative80.4%
*-commutative80.4%
Simplified80.4%
Taylor expanded in l around inf 36.8%
neg-mul-136.8%
Simplified36.8%
Taylor expanded in M around 0 36.1%
Final simplification36.1%
(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 79.0%
associate-/l*79.4%
exp-diff24.7%
sub-neg24.7%
exp-sum18.0%
associate-/r*18.0%
exp-diff24.7%
exp-diff79.4%
sub-neg79.4%
remove-double-neg79.4%
fabs-sub79.4%
Simplified79.4%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Taylor expanded in n around 0 76.4%
+-commutative76.4%
unpow276.4%
distribute-rgt-out80.4%
*-commutative80.4%
*-commutative80.4%
Simplified80.4%
Taylor expanded in l around inf 36.8%
neg-mul-136.8%
Simplified36.8%
Taylor expanded in l around 0 5.4%
Final simplification5.4%
herbie shell --seed 2023305
(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)))))))