
(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 12 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
(let* ((t_0 (- (fabs (- m n)) l))
(t_1 (exp (- t_0 (pow (- (/ (+ m n) 2.0) M) 2.0)))))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_1) INFINITY)
(* (cos (- (/ K (/ 2.0 (+ m n))) M)) t_1)
(*
(* K 0.5)
(* (* n (exp (- t_0 (pow (- (* (+ m n) 0.5) M) 2.0)))) (sin M))))))assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((m - n)) - l;
double t_1 = exp((t_0 - pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_1) <= ((double) INFINITY)) {
tmp = cos(((K / (2.0 / (m + n))) - M)) * t_1;
} else {
tmp = (K * 0.5) * ((n * exp((t_0 - pow((((m + n) * 0.5) - M), 2.0)))) * sin(M));
}
return tmp;
}
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.abs((m - n)) - l;
double t_1 = Math.exp((t_0 - Math.pow((((m + n) / 2.0) - M), 2.0)));
double tmp;
if ((Math.cos((((K * (m + n)) / 2.0) - M)) * t_1) <= Double.POSITIVE_INFINITY) {
tmp = Math.cos(((K / (2.0 / (m + n))) - M)) * t_1;
} else {
tmp = (K * 0.5) * ((n * Math.exp((t_0 - Math.pow((((m + n) * 0.5) - M), 2.0)))) * Math.sin(M));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): t_0 = math.fabs((m - n)) - l t_1 = math.exp((t_0 - math.pow((((m + n) / 2.0) - M), 2.0))) tmp = 0 if (math.cos((((K * (m + n)) / 2.0) - M)) * t_1) <= math.inf: tmp = math.cos(((K / (2.0 / (m + n))) - M)) * t_1 else: tmp = (K * 0.5) * ((n * math.exp((t_0 - math.pow((((m + n) * 0.5) - M), 2.0)))) * math.sin(M)) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) t_0 = Float64(abs(Float64(m - n)) - l) t_1 = exp(Float64(t_0 - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_1) <= Inf) tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / Float64(m + n))) - M)) * t_1); else tmp = Float64(Float64(K * 0.5) * Float64(Float64(n * exp(Float64(t_0 - (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0)))) * sin(M))); 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 = abs((m - n)) - l;
t_1 = exp((t_0 - ((((m + n) / 2.0) - M) ^ 2.0)));
tmp = 0.0;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_1) <= Inf)
tmp = cos(((K / (2.0 / (m + n))) - M)) * t_1;
else
tmp = (K * 0.5) * ((n * exp((t_0 - ((((m + n) * 0.5) - M) ^ 2.0)))) * sin(M));
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[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(t$95$0 - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], Infinity], N[(N[Cos[N[(N[(K / N[(2.0 / N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[(K * 0.5), $MachinePrecision] * N[(N[(n * N[Exp[N[(t$95$0 - N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision] * N[Sin[M], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
t_1 := e^{t_0 - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t_1 \leq \infty:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{m + n}} - M\right) \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\left(K \cdot 0.5\right) \cdot \left(\left(n \cdot e^{t_0 - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}\right) \cdot \sin M\right)\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) 2) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) 2) M) 2)) (-.f64 l (fabs.f64 (-.f64 m n)))))) < +inf.0Initial program 97.3%
associate-/l*98.3%
+-commutative98.3%
fabs-sub98.3%
+-commutative98.3%
Simplified98.3%
if +inf.0 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) 2) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) 2) M) 2)) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 0.0%
associate-/l*0.0%
+-commutative0.0%
fabs-sub0.0%
+-commutative0.0%
Simplified0.0%
Taylor expanded in K around 0 31.5%
cos-neg31.5%
sin-neg31.5%
Simplified31.5%
Taylor expanded in n around inf 98.1%
Simplified98.1%
Final simplification98.3%
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 (* (exp (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0))) (cos M)))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0))) * 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 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0))) * 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.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0))) * Math.cos(M);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0))) * math.cos(M)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return Float64(exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))) * cos(M)) end
K, m, n, M, l = num2cell(sort([K, m, n, M, l])){:}
function tmp = code(K, m, n, M, l)
tmp = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))) * 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[(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] * N[Cos[M], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}} \cdot \cos M
\end{array}
Initial program 76.8%
associate-/l*77.6%
+-commutative77.6%
fabs-sub77.6%
+-commutative77.6%
Simplified77.6%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Final simplification97.0%
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 -12800000000000.0)
(* (cos M) (exp (* (pow m 2.0) -0.25)))
(if (<= m -7.4e-272)
(*
(cos (- (/ (* K (+ m n)) 2.0) M))
(exp (+ (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) (- (fabs (- m n)) l))))
(* (cos M) (exp (* -0.25 (pow n 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 <= -12800000000000.0) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} else if (m <= -7.4e-272) {
tmp = cos((((K * (m + n)) / 2.0) - M)) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (fabs((m - n)) - l)));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 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 <= (-12800000000000.0d0)) then
tmp = cos(m_1) * exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= (-7.4d-272)) then
tmp = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp(((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) + (abs((m - n)) - l)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 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 <= -12800000000000.0) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= -7.4e-272) {
tmp = Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (Math.abs((m - n)) - l)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 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 <= -12800000000000.0: tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) elif m <= -7.4e-272: tmp = math.cos((((K * (m + n)) / 2.0) - M)) * math.exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (math.fabs((m - n)) - l))) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 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 <= -12800000000000.0) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); elseif (m <= -7.4e-272) tmp = Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) + Float64(abs(Float64(m - n)) - l)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 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 <= -12800000000000.0)
tmp = cos(M) * exp(((m ^ 2.0) * -0.25));
elseif (m <= -7.4e-272)
tmp = cos((((K * (m + n)) / 2.0) - M)) * exp(((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) + (abs((m - n)) - l)));
else
tmp = cos(M) * exp((-0.25 * (n ^ 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, -12800000000000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -7.4e-272], N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $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], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $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 -12800000000000:\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq -7.4 \cdot 10^{-272}:\\
\;\;\;\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \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)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -1.28e13Initial program 70.0%
associate-/l*70.0%
+-commutative70.0%
fabs-sub70.0%
+-commutative70.0%
Simplified70.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 96.7%
*-commutative96.7%
Simplified96.7%
if -1.28e13 < m < -7.3999999999999994e-272Initial program 91.9%
Taylor expanded in m around 0 91.9%
+-commutative91.9%
unpow291.9%
distribute-rgt-out91.9%
*-commutative91.9%
*-commutative91.9%
Simplified91.9%
if -7.3999999999999994e-272 < m Initial program 72.9%
associate-/l*72.8%
+-commutative72.8%
fabs-sub72.8%
+-commutative72.8%
Simplified72.8%
Taylor expanded in K around 0 95.7%
cos-neg95.7%
Simplified95.7%
Taylor expanded in n around inf 57.1%
*-commutative57.1%
Simplified57.1%
Final simplification74.8%
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 -53.0)
(* (cos M) (exp (* (pow m 2.0) -0.25)))
(if (<= m -2.2e-268)
(/ (cos M) (exp (pow M 2.0)))
(* (cos M) (exp (* -0.25 (pow n 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 <= -53.0) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} else if (m <= -2.2e-268) {
tmp = cos(M) / exp(pow(M, 2.0));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 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 <= (-53.0d0)) then
tmp = cos(m_1) * exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= (-2.2d-268)) 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
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 <= -53.0) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= -2.2e-268) {
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;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if m <= -53.0: tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) elif m <= -2.2e-268: 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
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -53.0) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); elseif (m <= -2.2e-268) tmp = Float64(cos(M) / exp((M ^ 2.0))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 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 <= -53.0)
tmp = cos(M) * exp(((m ^ 2.0) * -0.25));
elseif (m <= -2.2e-268)
tmp = cos(M) / exp((M ^ 2.0));
else
tmp = cos(M) * exp((-0.25 * (n ^ 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, -53.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -2.2e-268], 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}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;m \leq -53:\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq -2.2 \cdot 10^{-268}:\\
\;\;\;\;\frac{\cos M}{e^{{M}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -53Initial program 72.3%
associate-/l*72.3%
+-commutative72.3%
fabs-sub72.3%
+-commutative72.3%
Simplified72.3%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 97.0%
*-commutative97.0%
Simplified97.0%
if -53 < m < -2.20000000000000004e-268Initial program 90.9%
associate-/l*94.5%
+-commutative94.5%
fabs-sub94.5%
+-commutative94.5%
Simplified94.5%
Taylor expanded in K around 0 96.4%
cos-neg96.4%
Simplified96.4%
Taylor expanded in M around inf 53.7%
mul-1-neg53.7%
Simplified53.7%
exp-neg53.7%
un-div-inv53.7%
Applied egg-rr53.7%
if -2.20000000000000004e-268 < m Initial program 73.3%
associate-/l*73.2%
+-commutative73.2%
fabs-sub73.2%
+-commutative73.2%
Simplified73.2%
Taylor expanded in K around 0 95.7%
cos-neg95.7%
Simplified95.7%
Taylor expanded in n around inf 57.8%
*-commutative57.8%
Simplified57.8%
Final simplification66.8%
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 -720.0) (* 0.5 (* m (* (exp l) (* K (sin M))))) (if (<= l 720.0) (/ (cos M) (exp (pow M 2.0))) (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 <= -720.0) {
tmp = 0.5 * (m * (exp(l) * (K * sin(M))));
} else if (l <= 720.0) {
tmp = cos(M) / exp(pow(M, 2.0));
} else {
tmp = 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 <= (-720.0d0)) then
tmp = 0.5d0 * (m * (exp(l) * (k * sin(m_1))))
else if (l <= 720.0d0) then
tmp = cos(m_1) / exp((m_1 ** 2.0d0))
else
tmp = 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 <= -720.0) {
tmp = 0.5 * (m * (Math.exp(l) * (K * Math.sin(M))));
} else if (l <= 720.0) {
tmp = Math.cos(M) / Math.exp(Math.pow(M, 2.0));
} else {
tmp = 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 <= -720.0: tmp = 0.5 * (m * (math.exp(l) * (K * math.sin(M)))) elif l <= 720.0: tmp = math.cos(M) / math.exp(math.pow(M, 2.0)) else: tmp = 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 <= -720.0) tmp = Float64(0.5 * Float64(m * Float64(exp(l) * Float64(K * sin(M))))); elseif (l <= 720.0) tmp = Float64(cos(M) / exp((M ^ 2.0))); else tmp = 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 <= -720.0)
tmp = 0.5 * (m * (exp(l) * (K * sin(M))));
elseif (l <= 720.0)
tmp = cos(M) / exp((M ^ 2.0));
else
tmp = 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, -720.0], N[(0.5 * N[(m * N[(N[Exp[l], $MachinePrecision] * N[(K * N[Sin[M], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 720.0], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[Power[M, 2.0], $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -720:\\
\;\;\;\;0.5 \cdot \left(m \cdot \left(e^{\ell} \cdot \left(K \cdot \sin M\right)\right)\right)\\
\mathbf{elif}\;\ell \leq 720:\\
\;\;\;\;\frac{\cos M}{e^{{M}^{2}}}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < -720Initial program 77.4%
associate-/l*79.8%
+-commutative79.8%
fabs-sub79.8%
+-commutative79.8%
Simplified79.8%
Taylor expanded in K around 0 78.6%
cos-neg78.6%
sin-neg78.6%
Simplified78.6%
Taylor expanded in l around inf 19.0%
mul-1-neg23.5%
Simplified19.0%
Taylor expanded in m around inf 15.4%
*-commutative15.4%
Simplified15.4%
expm1-log1p-u11.3%
expm1-udef11.3%
associate-*r*8.9%
*-commutative8.9%
associate-*l*11.3%
add-sqr-sqrt11.3%
sqrt-unprod11.3%
sqr-neg11.3%
sqrt-unprod0.0%
add-sqr-sqrt74.2%
Applied egg-rr74.2%
expm1-def74.2%
expm1-log1p74.2%
associate-*r*74.2%
*-commutative74.2%
Simplified74.2%
if -720 < l < 720Initial program 77.6%
associate-/l*77.5%
+-commutative77.5%
fabs-sub77.5%
+-commutative77.5%
Simplified77.5%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in M around inf 60.8%
mul-1-neg60.8%
Simplified60.8%
exp-neg60.8%
un-div-inv60.8%
Applied egg-rr60.8%
if 720 < l Initial program 74.0%
associate-/l*74.0%
+-commutative74.0%
fabs-sub74.0%
+-commutative74.0%
Simplified74.0%
Taylor expanded in K around 0 84.0%
cos-neg84.0%
sin-neg84.0%
Simplified84.0%
Taylor expanded in l around inf 84.0%
mul-1-neg74.0%
Simplified84.0%
Taylor expanded in M around 0 100.0%
Final simplification72.8%
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 -53.0) (* (cos M) (exp (* (pow m 2.0) -0.25))) (/ (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 <= -53.0) {
tmp = cos(M) * exp((pow(m, 2.0) * -0.25));
} 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 <= (-53.0d0)) then
tmp = cos(m_1) * exp(((m ** 2.0d0) * (-0.25d0)))
else
tmp = cos(m_1) / exp((m_1 ** 2.0d0))
end if
code = tmp
end function
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 <= -53.0) {
tmp = Math.cos(M) * Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.cos(M) / Math.exp(Math.pow(M, 2.0));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if m <= -53.0: tmp = math.cos(M) * math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.cos(M) / math.exp(math.pow(M, 2.0)) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (m <= -53.0) tmp = Float64(cos(M) * exp(Float64((m ^ 2.0) * -0.25))); else tmp = Float64(cos(M) / exp((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 <= -53.0)
tmp = cos(M) * exp(((m ^ 2.0) * -0.25));
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, -53.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[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 -53:\\
\;\;\;\;\cos M \cdot e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{{M}^{2}}}\\
\end{array}
\end{array}
if m < -53Initial program 72.3%
associate-/l*72.3%
+-commutative72.3%
fabs-sub72.3%
+-commutative72.3%
Simplified72.3%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 97.0%
*-commutative97.0%
Simplified97.0%
if -53 < m Initial program 78.3%
associate-/l*79.4%
+-commutative79.4%
fabs-sub79.4%
+-commutative79.4%
Simplified79.4%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in M around inf 60.2%
mul-1-neg60.2%
Simplified60.2%
exp-neg60.2%
un-div-inv60.2%
Applied egg-rr60.2%
Final simplification69.5%
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 (<= n 2.5e-17) (* (cos M) (exp (- l))) (* 0.5 (* K (/ m (/ (exp l) (sin M)))))))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2.5e-17) {
tmp = cos(M) * exp(-l);
} else {
tmp = 0.5 * (K * (m / (exp(l) / sin(M))));
}
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 (n <= 2.5d-17) then
tmp = cos(m_1) * exp(-l)
else
tmp = 0.5d0 * (k * (m / (exp(l) / sin(m_1))))
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 (n <= 2.5e-17) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = 0.5 * (K * (m / (Math.exp(l) / Math.sin(M))));
}
return tmp;
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): tmp = 0 if n <= 2.5e-17: tmp = math.cos(M) * math.exp(-l) else: tmp = 0.5 * (K * (m / (math.exp(l) / math.sin(M)))) return tmp
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) tmp = 0.0 if (n <= 2.5e-17) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = Float64(0.5 * Float64(K * Float64(m / Float64(exp(l) / sin(M))))); 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 (n <= 2.5e-17)
tmp = cos(M) * exp(-l);
else
tmp = 0.5 * (K * (m / (exp(l) / sin(M))));
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[n, 2.5e-17], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(K * N[(m / N[(N[Exp[l], $MachinePrecision] / N[Sin[M], $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}\;n \leq 2.5 \cdot 10^{-17}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(K \cdot \frac{m}{\frac{e^{\ell}}{\sin M}}\right)\\
\end{array}
\end{array}
if n < 2.4999999999999999e-17Initial program 78.6%
associate-/l*79.7%
+-commutative79.7%
fabs-sub79.7%
+-commutative79.7%
Simplified79.7%
Taylor expanded in l around inf 32.8%
mul-1-neg32.8%
Simplified32.8%
Taylor expanded in K around 0 35.1%
cos-neg35.1%
Simplified35.1%
if 2.4999999999999999e-17 < n Initial program 71.6%
associate-/l*71.6%
+-commutative71.6%
fabs-sub71.6%
+-commutative71.6%
Simplified71.6%
Taylor expanded in K around 0 76.1%
cos-neg76.1%
sin-neg76.1%
Simplified76.1%
Taylor expanded in l around inf 18.0%
mul-1-neg17.8%
Simplified18.0%
Taylor expanded in m around inf 36.0%
*-commutative36.0%
Simplified36.0%
associate-*r*35.9%
exp-neg35.9%
un-div-inv35.9%
Applied egg-rr35.9%
associate-/l*37.4%
Simplified37.4%
Final simplification35.7%
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 4e-97) (* 0.5 (* m (* (exp l) (* K (sin M))))) (* (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 <= 4e-97) {
tmp = 0.5 * (m * (exp(l) * (K * sin(M))));
} 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 <= 4d-97) then
tmp = 0.5d0 * (m * (exp(l) * (k * sin(m_1))))
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 <= 4e-97) {
tmp = 0.5 * (m * (Math.exp(l) * (K * Math.sin(M))));
} 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 <= 4e-97: tmp = 0.5 * (m * (math.exp(l) * (K * math.sin(M)))) 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 <= 4e-97) tmp = Float64(0.5 * Float64(m * Float64(exp(l) * Float64(K * sin(M))))); 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 <= 4e-97)
tmp = 0.5 * (m * (exp(l) * (K * sin(M))));
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, 4e-97], N[(0.5 * N[(m * N[(N[Exp[l], $MachinePrecision] * N[(K * N[Sin[M], $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 4 \cdot 10^{-97}:\\
\;\;\;\;0.5 \cdot \left(m \cdot \left(e^{\ell} \cdot \left(K \cdot \sin M\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < 4.00000000000000014e-97Initial program 77.2%
associate-/l*78.3%
+-commutative78.3%
fabs-sub78.3%
+-commutative78.3%
Simplified78.3%
Taylor expanded in K around 0 80.8%
cos-neg80.8%
sin-neg80.8%
Simplified80.8%
Taylor expanded in l around inf 15.3%
mul-1-neg17.5%
Simplified15.3%
Taylor expanded in m around inf 17.2%
*-commutative17.2%
Simplified17.2%
expm1-log1p-u15.1%
expm1-udef29.2%
associate-*r*28.1%
*-commutative28.1%
associate-*l*29.2%
add-sqr-sqrt17.7%
sqrt-unprod29.2%
sqr-neg29.2%
sqrt-unprod11.5%
add-sqr-sqrt57.6%
Applied egg-rr57.6%
expm1-def45.9%
expm1-log1p46.2%
associate-*r*46.2%
*-commutative46.2%
Simplified46.2%
if 4.00000000000000014e-97 < l Initial program 75.7%
associate-/l*75.7%
+-commutative75.7%
fabs-sub75.7%
+-commutative75.7%
Simplified75.7%
Taylor expanded in l around inf 59.1%
mul-1-neg59.1%
Simplified59.1%
Taylor expanded in K around 0 77.9%
cos-neg77.9%
Simplified77.9%
Final simplification54.9%
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 (<= n 5.6e-17) (* (cos M) (exp (- l))) (* 0.5 (* K (* m (/ 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 (n <= 5.6e-17) {
tmp = cos(M) * exp(-l);
} else {
tmp = 0.5 * (K * (m * (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 (n <= 5.6d-17) then
tmp = cos(m_1) * exp(-l)
else
tmp = 0.5d0 * (k * (m * (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 (n <= 5.6e-17) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = 0.5 * (K * (m * (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 n <= 5.6e-17: tmp = math.cos(M) * math.exp(-l) else: tmp = 0.5 * (K * (m * (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 (n <= 5.6e-17) tmp = Float64(cos(M) * exp(Float64(-l))); else tmp = Float64(0.5 * Float64(K * Float64(m * Float64(M / exp(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 (n <= 5.6e-17)
tmp = cos(M) * exp(-l);
else
tmp = 0.5 * (K * (m * (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[n, 5.6e-17], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(K * N[(m * N[(M / N[Exp[l], $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}\;n \leq 5.6 \cdot 10^{-17}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(K \cdot \left(m \cdot \frac{M}{e^{\ell}}\right)\right)\\
\end{array}
\end{array}
if n < 5.5999999999999998e-17Initial program 78.7%
associate-/l*79.8%
+-commutative79.8%
fabs-sub79.8%
+-commutative79.8%
Simplified79.8%
Taylor expanded in l around inf 32.6%
mul-1-neg32.6%
Simplified32.6%
Taylor expanded in K around 0 34.9%
cos-neg34.9%
Simplified34.9%
if 5.5999999999999998e-17 < n Initial program 71.2%
associate-/l*71.2%
+-commutative71.2%
fabs-sub71.2%
+-commutative71.2%
Simplified71.2%
Taylor expanded in K around 0 75.8%
cos-neg75.8%
sin-neg75.8%
Simplified75.8%
Taylor expanded in l around inf 18.2%
mul-1-neg18.0%
Simplified18.2%
Taylor expanded in m around inf 36.5%
*-commutative36.5%
Simplified36.5%
Taylor expanded in M around 0 36.4%
exp-neg36.4%
associate-*r/36.4%
*-rgt-identity36.4%
Simplified36.4%
Final simplification35.3%
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 (<= n 5.6e-17) (exp (- l)) (* 0.5 (* K (* m (/ 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 (n <= 5.6e-17) {
tmp = exp(-l);
} else {
tmp = 0.5 * (K * (m * (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 (n <= 5.6d-17) then
tmp = exp(-l)
else
tmp = 0.5d0 * (k * (m * (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 (n <= 5.6e-17) {
tmp = Math.exp(-l);
} else {
tmp = 0.5 * (K * (m * (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 n <= 5.6e-17: tmp = math.exp(-l) else: tmp = 0.5 * (K * (m * (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 (n <= 5.6e-17) tmp = exp(Float64(-l)); else tmp = Float64(0.5 * Float64(K * Float64(m * Float64(M / exp(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 (n <= 5.6e-17)
tmp = exp(-l);
else
tmp = 0.5 * (K * (m * (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[n, 5.6e-17], N[Exp[(-l)], $MachinePrecision], N[(0.5 * N[(K * N[(m * N[(M / N[Exp[l], $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}\;n \leq 5.6 \cdot 10^{-17}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(K \cdot \left(m \cdot \frac{M}{e^{\ell}}\right)\right)\\
\end{array}
\end{array}
if n < 5.5999999999999998e-17Initial program 78.7%
associate-/l*79.8%
+-commutative79.8%
fabs-sub79.8%
+-commutative79.8%
Simplified79.8%
Taylor expanded in K around 0 84.8%
cos-neg84.8%
sin-neg84.8%
Simplified84.8%
Taylor expanded in l around inf 33.1%
mul-1-neg32.6%
Simplified33.1%
Taylor expanded in M around 0 34.9%
if 5.5999999999999998e-17 < n Initial program 71.2%
associate-/l*71.2%
+-commutative71.2%
fabs-sub71.2%
+-commutative71.2%
Simplified71.2%
Taylor expanded in K around 0 75.8%
cos-neg75.8%
sin-neg75.8%
Simplified75.8%
Taylor expanded in l around inf 18.2%
mul-1-neg18.0%
Simplified18.2%
Taylor expanded in m around inf 36.5%
*-commutative36.5%
Simplified36.5%
Taylor expanded in M around 0 36.4%
exp-neg36.4%
associate-*r/36.4%
*-rgt-identity36.4%
Simplified36.4%
Final simplification35.3%
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 (exp (- l)))
assert(K < m && m < n && n < M && M < l);
double code(double K, double m, double n, double M, double l) {
return 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 = 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.exp(-l);
}
[K, m, n, M, l] = sort([K, m, n, M, l]) def code(K, m, n, M, l): return math.exp(-l)
K, m, n, M, l = sort([K, m, n, M, l]) function code(K, m, n, M, l) return 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 = 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[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
[K, m, n, M, l] = \mathsf{sort}([K, m, n, M, l])\\
\\
e^{-\ell}
\end{array}
Initial program 76.8%
associate-/l*77.6%
+-commutative77.6%
fabs-sub77.6%
+-commutative77.6%
Simplified77.6%
Taylor expanded in K around 0 82.5%
cos-neg82.5%
sin-neg82.5%
Simplified82.5%
Taylor expanded in l around inf 29.2%
mul-1-neg28.9%
Simplified29.2%
Taylor expanded in M around 0 33.0%
Final simplification33.0%
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}
Initial program 76.8%
associate-/l*77.6%
+-commutative77.6%
fabs-sub77.6%
+-commutative77.6%
Simplified77.6%
Taylor expanded in l around inf 28.9%
mul-1-neg28.9%
Simplified28.9%
Taylor expanded in l around 0 7.7%
Taylor expanded in K around 0 8.2%
cos-neg8.2%
Simplified8.2%
Final simplification8.2%
herbie shell --seed 2023339
(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)))))))