
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 11 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= m -1200000000000.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(cos M)
(exp (+ (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (- (fabs (- n m)) l))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1200000000000.0) {
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((n - m)) - l)));
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 <= (-1200000000000.0d0)) 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((n - m)) - l)))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1200000000000.0) {
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((n - m)) - l)));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if m <= -1200000000000.0: 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((n - m)) - l))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -1200000000000.0) 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(n - m)) - l)))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -1200000000000.0)
tmp = cos(M) * exp((-0.25 * (m ^ 2.0)));
else
tmp = cos(M) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (abs((n - m)) - l)));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -1200000000000.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[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1200000000000:\\
\;\;\;\;\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|n - m\right| - \ell\right)}\\
\end{array}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (fabs (- n m)) l) (pow (- (* (+ n m) 0.5) M) 2.0)))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((n - m)) - l) - pow((((n + m) * 0.5) - M), 2.0)));
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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)) - l) - ((((n + m) * 0.5d0) - m_1) ** 2.0d0)))
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((n - m)) - l) - Math.pow((((n + m) * 0.5) - M), 2.0)));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((n - m)) - l) - math.pow((((n + m) * 0.5) - M), 2.0)))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(n - m)) - l) - (Float64(Float64(Float64(n + m) * 0.5) - M) ^ 2.0)))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M) * exp(((abs((n - m)) - l) - ((((n + m) * 0.5) - M) ^ 2.0)));
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(n + m), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - {\left(\left(n + m\right) \cdot 0.5 - M\right)}^{2}}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= m -0.0116)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(*
(cos M)
(exp (+ (- n m) (- (* (- (* m 0.5) M) (- (- M n) (* m 0.5))) l))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.0116) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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.0116d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((n - m) + ((((m * 0.5d0) - m_1) * ((m_1 - n) - (m * 0.5d0))) - l)))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -0.0116) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if m <= -0.0116: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -0.0116) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(n - m) + Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - n) - Float64(m * 0.5))) - l)))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (m <= -0.0116)
tmp = cos(M) * exp((-0.25 * (m ^ 2.0)));
else
tmp = cos(M) * exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[m, -0.0116], 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 - m), $MachinePrecision] + N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - n), $MachinePrecision] - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.0116:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(n - m\right) + \left(\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - n\right) - m \cdot 0.5\right) - \ell\right)}\\
\end{array}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= M 0.057)
(*
(cos M)
(exp (+ (- n m) (- (* (- (* m 0.5) M) (- (- M n) (* m 0.5))) l))))
(* (cos M) (exp (- (pow M 2.0))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= 0.057) {
tmp = cos(M) * exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
} else {
tmp = cos(M) * exp(-pow(M, 2.0));
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 <= 0.057d0) then
tmp = cos(m_1) * exp(((n - m) + ((((m * 0.5d0) - m_1) * ((m_1 - n) - (m * 0.5d0))) - l)))
else
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= 0.057) {
tmp = Math.cos(M) * Math.exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
} else {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if M <= 0.057: tmp = math.cos(M) * math.exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l))) else: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (M <= 0.057) tmp = Float64(cos(M) * exp(Float64(Float64(n - m) + Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - n) - Float64(m * 0.5))) - l)))); else tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (M <= 0.057)
tmp = cos(M) * exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
else
tmp = cos(M) * exp(-(M ^ 2.0));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[M, 0.057], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - n), $MachinePrecision] - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;M \leq 0.057:\\
\;\;\;\;\cos M \cdot e^{\left(n - m\right) + \left(\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - n\right) - m \cdot 0.5\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\end{array}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* n (- M (* m 0.5))))))
(t_1 (* (cos M) (exp (+ (- n m) (- (* n (- (* m 0.5) M)) l))))))
(if (<= l -4.9e+250)
t_1
(if (<= l -1.2e+17)
(* (cos (- (* (+ n m) (/ K 2.0)) M)) (exp l))
(if (<= l 2.8e-282)
t_0
(if (<= l 5.8e-229)
t_1
(if (<= l 1.18e-30) t_0 (* (cos M) (exp (- l))))))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((n * (M - (m * 0.5))));
double t_1 = cos(M) * exp(((n - m) + ((n * ((m * 0.5) - M)) - l)));
double tmp;
if (l <= -4.9e+250) {
tmp = t_1;
} else if (l <= -1.2e+17) {
tmp = cos((((n + m) * (K / 2.0)) - M)) * exp(l);
} else if (l <= 2.8e-282) {
tmp = t_0;
} else if (l <= 5.8e-229) {
tmp = t_1;
} else if (l <= 1.18e-30) {
tmp = t_0;
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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((n * (m_1 - (m * 0.5d0))))
t_1 = cos(m_1) * exp(((n - m) + ((n * ((m * 0.5d0) - m_1)) - l)))
if (l <= (-4.9d+250)) then
tmp = t_1
else if (l <= (-1.2d+17)) then
tmp = cos((((n + m) * (k / 2.0d0)) - m_1)) * exp(l)
else if (l <= 2.8d-282) then
tmp = t_0
else if (l <= 5.8d-229) then
tmp = t_1
else if (l <= 1.18d-30) then
tmp = t_0
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
double t_1 = Math.cos(M) * Math.exp(((n - m) + ((n * ((m * 0.5) - M)) - l)));
double tmp;
if (l <= -4.9e+250) {
tmp = t_1;
} else if (l <= -1.2e+17) {
tmp = Math.cos((((n + m) * (K / 2.0)) - M)) * Math.exp(l);
} else if (l <= 2.8e-282) {
tmp = t_0;
} else if (l <= 5.8e-229) {
tmp = t_1;
} else if (l <= 1.18e-30) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((n * (M - (m * 0.5)))) t_1 = math.cos(M) * math.exp(((n - m) + ((n * ((m * 0.5) - M)) - l))) tmp = 0 if l <= -4.9e+250: tmp = t_1 elif l <= -1.2e+17: tmp = math.cos((((n + m) * (K / 2.0)) - M)) * math.exp(l) elif l <= 2.8e-282: tmp = t_0 elif l <= 5.8e-229: tmp = t_1 elif l <= 1.18e-30: tmp = t_0 else: tmp = math.cos(M) * math.exp(-l) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))) t_1 = Float64(cos(M) * exp(Float64(Float64(n - m) + Float64(Float64(n * Float64(Float64(m * 0.5) - M)) - l)))) tmp = 0.0 if (l <= -4.9e+250) tmp = t_1; elseif (l <= -1.2e+17) tmp = Float64(cos(Float64(Float64(Float64(n + m) * Float64(K / 2.0)) - M)) * exp(l)); elseif (l <= 2.8e-282) tmp = t_0; elseif (l <= 5.8e-229) tmp = t_1; elseif (l <= 1.18e-30) tmp = t_0; else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = cos(M) * exp((n * (M - (m * 0.5))));
t_1 = cos(M) * exp(((n - m) + ((n * ((m * 0.5) - M)) - l)));
tmp = 0.0;
if (l <= -4.9e+250)
tmp = t_1;
elseif (l <= -1.2e+17)
tmp = cos((((n + m) * (K / 2.0)) - M)) * exp(l);
elseif (l <= 2.8e-282)
tmp = t_0;
elseif (l <= 5.8e-229)
tmp = t_1;
elseif (l <= 1.18e-30)
tmp = t_0;
else
tmp = cos(M) * exp(-l);
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(n * N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[l, -4.9e+250], t$95$1, If[LessEqual[l, -1.2e+17], N[(N[Cos[N[(N[(N[(n + m), $MachinePrecision] * N[(K / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 2.8e-282], t$95$0, If[LessEqual[l, 5.8e-229], t$95$1, If[LessEqual[l, 1.18e-30], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]]]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
t_1 := \cos M \cdot e^{\left(n - m\right) + \left(n \cdot \left(m \cdot 0.5 - M\right) - \ell\right)}\\
\mathbf{if}\;\ell \leq -4.9 \cdot 10^{+250}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq -1.2 \cdot 10^{+17}:\\
\;\;\;\;\cos \left(\left(n + m\right) \cdot \frac{K}{2} - M\right) \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 2.8 \cdot 10^{-282}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;\ell \leq 5.8 \cdot 10^{-229}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;\ell \leq 1.18 \cdot 10^{-30}:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (* (cos M) (exp (+ (- n m) (- (* (- (* m 0.5) M) (- (- M n) (* m 0.5))) l)))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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(((n - m) + ((((m * 0.5d0) - m_1) * ((m_1 - n) - (m * 0.5d0))) - l)))
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.cos(M) * math.exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)))
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(n - m) + Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - n) - Float64(m * 0.5))) - l)))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M) * exp(((n - m) + ((((m * 0.5) - M) * ((M - n) - (m * 0.5))) - l)));
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - n), $MachinePrecision] - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\cos M \cdot e^{\left(n - m\right) + \left(\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - n\right) - m \cdot 0.5\right) - \ell\right)}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (if (or (<= l -2.4e+251) (not (<= l 1.18e-30))) (* (cos M) (exp (- l))) (* (cos M) (exp (* n (- M (* m 0.5)))))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((l <= -2.4e+251) || !(l <= 1.18e-30)) {
tmp = cos(M) * exp(-l);
} else {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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.4d+251)) .or. (.not. (l <= 1.18d-30))) then
tmp = cos(m_1) * exp(-l)
else
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((l <= -2.4e+251) || !(l <= 1.18e-30)) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if (l <= -2.4e+251) or not (l <= 1.18e-30): tmp = math.cos(M) * math.exp(-l) else: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if ((l <= -2.4e+251) || !(l <= 1.18e-30)) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if ((l <= -2.4e+251) || ~((l <= 1.18e-30)))
tmp = cos(M) * exp(-l);
else
tmp = cos(M) * exp((n * (M - (m * 0.5))));
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[Or[LessEqual[l, -2.4e+251], N[Not[LessEqual[l, 1.18e-30]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.4 \cdot 10^{+251} \lor \neg \left(\ell \leq 1.18 \cdot 10^{-30}\right):\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\end{array}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- l))))
(if (<= l -1.12e+252)
(* t_0 (cos (- (/ K (/ 2.0 n)) M)))
(if (<= l 1.18e-30)
(* (cos M) (exp (* n (- M (* m 0.5)))))
(* (cos M) t_0)))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(-l);
double tmp;
if (l <= -1.12e+252) {
tmp = t_0 * cos(((K / (2.0 / n)) - M));
} else if (l <= 1.18e-30) {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
} else {
tmp = cos(M) * t_0;
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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 = exp(-l)
if (l <= (-1.12d+252)) then
tmp = t_0 * cos(((k / (2.0d0 / n)) - m_1))
else if (l <= 1.18d-30) then
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
else
tmp = cos(m_1) * t_0
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(-l);
double tmp;
if (l <= -1.12e+252) {
tmp = t_0 * Math.cos(((K / (2.0 / n)) - M));
} else if (l <= 1.18e-30) {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
} else {
tmp = Math.cos(M) * t_0;
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = math.exp(-l) tmp = 0 if l <= -1.12e+252: tmp = t_0 * math.cos(((K / (2.0 / n)) - M)) elif l <= 1.18e-30: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) else: tmp = math.cos(M) * t_0 return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = exp(Float64(-l)) tmp = 0.0 if (l <= -1.12e+252) tmp = Float64(t_0 * cos(Float64(Float64(K / Float64(2.0 / n)) - M))); elseif (l <= 1.18e-30) tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); else tmp = Float64(cos(M) * t_0); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
t_0 = exp(-l);
tmp = 0.0;
if (l <= -1.12e+252)
tmp = t_0 * cos(((K / (2.0 / n)) - M));
elseif (l <= 1.18e-30)
tmp = cos(M) * exp((n * (M - (m * 0.5))));
else
tmp = cos(M) * t_0;
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, If[LessEqual[l, -1.12e+252], N[(t$95$0 * N[Cos[N[(N[(K / N[(2.0 / n), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.18e-30], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * t$95$0), $MachinePrecision]]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
\mathbf{if}\;\ell \leq -1.12 \cdot 10^{+252}:\\
\;\;\;\;t_0 \cdot \cos \left(\frac{K}{\frac{2}{n}} - M\right)\\
\mathbf{elif}\;\ell \leq 1.18 \cdot 10^{-30}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot t_0\\
\end{array}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
(FPCore (K m n M l)
:precision binary64
(if (<= l -2.5e+16)
(* (cos (- (* (+ n m) (/ K 2.0)) M)) (exp l))
(if (<= l 1.18e-30)
(* (cos M) (exp (* n (- M (* m 0.5)))))
(* (cos M) (exp (- l))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -2.5e+16) {
tmp = cos((((n + m) * (K / 2.0)) - M)) * exp(l);
} else if (l <= 1.18e-30) {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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+16)) then
tmp = cos((((n + m) * (k / 2.0d0)) - m_1)) * exp(l)
else if (l <= 1.18d-30) then
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -2.5e+16) {
tmp = Math.cos((((n + m) * (K / 2.0)) - M)) * Math.exp(l);
} else if (l <= 1.18e-30) {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if l <= -2.5e+16: tmp = math.cos((((n + m) * (K / 2.0)) - M)) * math.exp(l) elif l <= 1.18e-30: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) else: tmp = math.cos(M) * math.exp(-l) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (l <= -2.5e+16) tmp = Float64(cos(Float64(Float64(Float64(n + m) * Float64(K / 2.0)) - M)) * exp(l)); elseif (l <= 1.18e-30) tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp_2 = code(K, m, n, M, l)
tmp = 0.0;
if (l <= -2.5e+16)
tmp = cos((((n + m) * (K / 2.0)) - M)) * exp(l);
elseif (l <= 1.18e-30)
tmp = cos(M) * exp((n * (M - (m * 0.5))));
else
tmp = cos(M) * exp(-l);
end
tmp_2 = tmp;
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := If[LessEqual[l, -2.5e+16], N[(N[Cos[N[(N[(N[(n + m), $MachinePrecision] * N[(K / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.18e-30], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.5 \cdot 10^{+16}:\\
\;\;\;\;\cos \left(\left(n + m\right) \cdot \frac{K}{2} - M\right) \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 1.18 \cdot 10^{-30}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- l))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(-l);
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(-l);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.cos(M) * math.exp(-l)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(-l))) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M) * exp(-l);
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\cos M \cdot e^{-\ell}
\end{array}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. (FPCore (K m n M l) :precision binary64 (cos M))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return cos(M);
}
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function.
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
assert K < m && m < n && n < M && M < l;
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.cos(M)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return cos(M) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = cos(M);
end
NOTE: K, m, n, M, and l should be sorted in increasing order before calling this function. code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\cos M
\end{array}
herbie shell --seed 2023340
(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)))))))