
(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}
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (fabs (- n m)) (+ l (pow (- (/ (+ m n) 2.0) M) 2.0))))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((fabs((n - m)) - (l + pow((((m + n) / 2.0) - M), 2.0))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp((abs((n - m)) - (l + ((((m + n) / 2.0d0) - m_1) ** 2.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((Math.abs((n - m)) - (l + Math.pow((((m + n) / 2.0) - M), 2.0))));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((math.fabs((n - m)) - (l + math.pow((((m + n) / 2.0) - M), 2.0))))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(abs(Float64(n - m)) - Float64(l + (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((abs((n - m)) - (l + ((((m + n) / 2.0) - M) ^ 2.0)))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(l + N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left|n - m\right| - \left(\ell + {\left(\frac{m + n}{2} - M\right)}^{2}\right)}
\end{array}
Initial program 76.0%
associate-/l*76.0%
exp-diff30.3%
sub-neg30.3%
exp-sum24.1%
associate-/r*24.1%
exp-diff28.4%
exp-diff76.0%
sub-neg76.0%
remove-double-neg76.0%
fabs-sub76.0%
Simplified76.0%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Final simplification97.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= M -6.0)
(* (cos M) (exp (+ t_0 (- (* M (- n M)) l))))
(if (<= M 1.05e-100)
(* (cos M) (exp (- t_0 (+ l (* 0.5 (* m (+ n (* m 0.5))))))))
(if (<= M 6.8)
(* (cos M) (exp (- t_0 (+ (* 0.5 (* n (+ m (* n 0.5)))) l))))
(* (cos M) (exp (+ (- t_0 l) (* M (- m M))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (M <= -6.0) {
tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l)));
} else if (M <= 1.05e-100) {
tmp = cos(M) * exp((t_0 - (l + (0.5 * (m * (n + (m * 0.5)))))));
} else if (M <= 6.8) {
tmp = cos(M) * exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l)));
} else {
tmp = cos(M) * exp(((t_0 - l) + (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) :: t_0
real(8) :: tmp
t_0 = abs((n - m))
if (m_1 <= (-6.0d0)) then
tmp = cos(m_1) * exp((t_0 + ((m_1 * (n - m_1)) - l)))
else if (m_1 <= 1.05d-100) then
tmp = cos(m_1) * exp((t_0 - (l + (0.5d0 * (m * (n + (m * 0.5d0)))))))
else if (m_1 <= 6.8d0) then
tmp = cos(m_1) * exp((t_0 - ((0.5d0 * (n * (m + (n * 0.5d0)))) + l)))
else
tmp = cos(m_1) * exp(((t_0 - l) + (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 t_0 = Math.abs((n - m));
double tmp;
if (M <= -6.0) {
tmp = Math.cos(M) * Math.exp((t_0 + ((M * (n - M)) - l)));
} else if (M <= 1.05e-100) {
tmp = Math.cos(M) * Math.exp((t_0 - (l + (0.5 * (m * (n + (m * 0.5)))))));
} else if (M <= 6.8) {
tmp = Math.cos(M) * Math.exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l)));
} else {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (M * (m - M))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if M <= -6.0: tmp = math.cos(M) * math.exp((t_0 + ((M * (n - M)) - l))) elif M <= 1.05e-100: tmp = math.cos(M) * math.exp((t_0 - (l + (0.5 * (m * (n + (m * 0.5))))))) elif M <= 6.8: tmp = math.cos(M) * math.exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l))) else: tmp = math.cos(M) * math.exp(((t_0 - l) + (M * (m - M)))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (M <= -6.0) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(M * Float64(n - M)) - l)))); elseif (M <= 1.05e-100) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(l + Float64(0.5 * Float64(m * Float64(n + Float64(m * 0.5)))))))); elseif (M <= 6.8) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(Float64(0.5 * Float64(n * Float64(m + Float64(n * 0.5)))) + l)))); else tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(M * Float64(m - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (M <= -6.0) tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l))); elseif (M <= 1.05e-100) tmp = cos(M) * exp((t_0 - (l + (0.5 * (m * (n + (m * 0.5))))))); elseif (M <= 6.8) tmp = cos(M) * exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l))); else tmp = cos(M) * exp(((t_0 - l) + (M * (m - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -6.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.05e-100], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(l + N[(0.5 * N[(m * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 6.8], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(N[(0.5 * N[(n * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;M \leq -6:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(M \cdot \left(n - M\right) - \ell\right)}\\
\mathbf{elif}\;M \leq 1.05 \cdot 10^{-100}:\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(\ell + 0.5 \cdot \left(m \cdot \left(n + m \cdot 0.5\right)\right)\right)}\\
\mathbf{elif}\;M \leq 6.8:\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(0.5 \cdot \left(n \cdot \left(m + n \cdot 0.5\right)\right) + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(t_0 - \ell\right) + M \cdot \left(m - M\right)}\\
\end{array}
\end{array}
if M < -6Initial program 77.1%
associate-/l*77.1%
exp-diff31.2%
sub-neg31.2%
exp-sum23.0%
associate-/r*23.0%
exp-diff27.9%
exp-diff77.1%
sub-neg77.1%
remove-double-neg77.1%
fabs-sub77.1%
Simplified77.1%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in n around 0 80.7%
+-commutative80.7%
unpow280.7%
distribute-rgt-out90.6%
*-commutative90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in m around 0 87.4%
associate-*r*87.4%
neg-mul-187.4%
Simplified87.4%
if -6 < M < 1.05000000000000005e-100Initial program 74.7%
associate-/l*74.9%
exp-diff29.9%
sub-neg29.9%
exp-sum24.8%
associate-/r*24.8%
exp-diff26.9%
exp-diff74.9%
sub-neg74.9%
remove-double-neg74.9%
fabs-sub74.9%
Simplified74.9%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in n around 0 63.1%
+-commutative63.1%
unpow263.1%
distribute-rgt-out67.2%
*-commutative67.2%
*-commutative67.2%
Simplified67.2%
Taylor expanded in M around 0 67.2%
*-commutative67.2%
Simplified67.2%
if 1.05000000000000005e-100 < M < 6.79999999999999982Initial program 76.0%
associate-/l*76.0%
exp-diff15.3%
sub-neg15.3%
exp-sum11.7%
associate-/r*11.7%
exp-diff11.7%
exp-diff76.0%
sub-neg76.0%
remove-double-neg76.0%
fabs-sub76.0%
Simplified76.0%
Taylor expanded in K around 0 92.9%
cos-neg92.9%
Simplified92.9%
Taylor expanded in m around 0 57.7%
+-commutative47.8%
unpow247.8%
distribute-rgt-out51.4%
*-commutative51.4%
*-commutative51.4%
Simplified61.3%
Taylor expanded in M around 0 61.3%
if 6.79999999999999982 < M Initial program 76.8%
associate-/l*76.8%
exp-diff36.2%
sub-neg36.2%
exp-sum29.0%
associate-/r*29.0%
exp-diff37.7%
exp-diff76.8%
sub-neg76.8%
remove-double-neg76.8%
fabs-sub76.8%
Simplified76.8%
Taylor expanded in m around 0 69.6%
+-commutative69.6%
unpow269.6%
distribute-rgt-out72.5%
*-commutative72.5%
*-commutative72.5%
Simplified72.5%
Taylor expanded in n around 0 68.3%
associate--r+68.3%
associate-*r*68.3%
neg-mul-168.3%
cancel-sign-sub68.3%
Simplified68.3%
Taylor expanded in K around 0 90.0%
cos-neg100.0%
Simplified90.0%
Final simplification77.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= M -1.2)
(* (cos M) (exp (+ t_0 (- (* M (- n M)) l))))
(if (<= M 1.12e-100)
(* (cos M) (exp (+ t_0 (- (* (* m 0.5) (- M (* m 0.5))) l))))
(if (<= M 9.0)
(* (cos M) (exp (- t_0 (+ (* 0.5 (* n (+ m (* n 0.5)))) l))))
(* (cos M) (exp (+ (- t_0 l) (* M (- m M))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (M <= -1.2) {
tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l)));
} else if (M <= 1.12e-100) {
tmp = cos(M) * exp((t_0 + (((m * 0.5) * (M - (m * 0.5))) - l)));
} else if (M <= 9.0) {
tmp = cos(M) * exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l)));
} else {
tmp = cos(M) * exp(((t_0 - l) + (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) :: t_0
real(8) :: tmp
t_0 = abs((n - m))
if (m_1 <= (-1.2d0)) then
tmp = cos(m_1) * exp((t_0 + ((m_1 * (n - m_1)) - l)))
else if (m_1 <= 1.12d-100) then
tmp = cos(m_1) * exp((t_0 + (((m * 0.5d0) * (m_1 - (m * 0.5d0))) - l)))
else if (m_1 <= 9.0d0) then
tmp = cos(m_1) * exp((t_0 - ((0.5d0 * (n * (m + (n * 0.5d0)))) + l)))
else
tmp = cos(m_1) * exp(((t_0 - l) + (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 t_0 = Math.abs((n - m));
double tmp;
if (M <= -1.2) {
tmp = Math.cos(M) * Math.exp((t_0 + ((M * (n - M)) - l)));
} else if (M <= 1.12e-100) {
tmp = Math.cos(M) * Math.exp((t_0 + (((m * 0.5) * (M - (m * 0.5))) - l)));
} else if (M <= 9.0) {
tmp = Math.cos(M) * Math.exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l)));
} else {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (M * (m - M))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if M <= -1.2: tmp = math.cos(M) * math.exp((t_0 + ((M * (n - M)) - l))) elif M <= 1.12e-100: tmp = math.cos(M) * math.exp((t_0 + (((m * 0.5) * (M - (m * 0.5))) - l))) elif M <= 9.0: tmp = math.cos(M) * math.exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l))) else: tmp = math.cos(M) * math.exp(((t_0 - l) + (M * (m - M)))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (M <= -1.2) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(M * Float64(n - M)) - l)))); elseif (M <= 1.12e-100) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(Float64(m * 0.5) * Float64(M - Float64(m * 0.5))) - l)))); elseif (M <= 9.0) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(Float64(0.5 * Float64(n * Float64(m + Float64(n * 0.5)))) + l)))); else tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(M * Float64(m - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (M <= -1.2) tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l))); elseif (M <= 1.12e-100) tmp = cos(M) * exp((t_0 + (((m * 0.5) * (M - (m * 0.5))) - l))); elseif (M <= 9.0) tmp = cos(M) * exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l))); else tmp = cos(M) * exp(((t_0 - l) + (M * (m - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -1.2], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.12e-100], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(N[(m * 0.5), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 9.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(N[(0.5 * N[(n * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;M \leq -1.2:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(M \cdot \left(n - M\right) - \ell\right)}\\
\mathbf{elif}\;M \leq 1.12 \cdot 10^{-100}:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(\left(m \cdot 0.5\right) \cdot \left(M - m \cdot 0.5\right) - \ell\right)}\\
\mathbf{elif}\;M \leq 9:\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(0.5 \cdot \left(n \cdot \left(m + n \cdot 0.5\right)\right) + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(t_0 - \ell\right) + M \cdot \left(m - M\right)}\\
\end{array}
\end{array}
if M < -1.19999999999999996Initial program 77.1%
associate-/l*77.1%
exp-diff31.2%
sub-neg31.2%
exp-sum23.0%
associate-/r*23.0%
exp-diff27.9%
exp-diff77.1%
sub-neg77.1%
remove-double-neg77.1%
fabs-sub77.1%
Simplified77.1%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in n around 0 80.7%
+-commutative80.7%
unpow280.7%
distribute-rgt-out90.6%
*-commutative90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in m around 0 87.4%
associate-*r*87.4%
neg-mul-187.4%
Simplified87.4%
if -1.19999999999999996 < M < 1.11999999999999996e-100Initial program 74.7%
associate-/l*74.9%
exp-diff29.9%
sub-neg29.9%
exp-sum24.8%
associate-/r*24.8%
exp-diff26.9%
exp-diff74.9%
sub-neg74.9%
remove-double-neg74.9%
fabs-sub74.9%
Simplified74.9%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in n around 0 63.1%
+-commutative63.1%
unpow263.1%
distribute-rgt-out67.2%
*-commutative67.2%
*-commutative67.2%
Simplified67.2%
Taylor expanded in m around inf 70.2%
*-commutative70.2%
Simplified70.2%
if 1.11999999999999996e-100 < M < 9Initial program 76.0%
associate-/l*76.0%
exp-diff15.3%
sub-neg15.3%
exp-sum11.7%
associate-/r*11.7%
exp-diff11.7%
exp-diff76.0%
sub-neg76.0%
remove-double-neg76.0%
fabs-sub76.0%
Simplified76.0%
Taylor expanded in K around 0 92.9%
cos-neg92.9%
Simplified92.9%
Taylor expanded in m around 0 57.7%
+-commutative47.8%
unpow247.8%
distribute-rgt-out51.4%
*-commutative51.4%
*-commutative51.4%
Simplified61.3%
Taylor expanded in M around 0 61.3%
if 9 < M Initial program 76.8%
associate-/l*76.8%
exp-diff36.2%
sub-neg36.2%
exp-sum29.0%
associate-/r*29.0%
exp-diff37.7%
exp-diff76.8%
sub-neg76.8%
remove-double-neg76.8%
fabs-sub76.8%
Simplified76.8%
Taylor expanded in m around 0 69.6%
+-commutative69.6%
unpow269.6%
distribute-rgt-out72.5%
*-commutative72.5%
*-commutative72.5%
Simplified72.5%
Taylor expanded in n around 0 68.3%
associate--r+68.3%
associate-*r*68.3%
neg-mul-168.3%
cancel-sign-sub68.3%
Simplified68.3%
Taylor expanded in K around 0 90.0%
cos-neg100.0%
Simplified90.0%
Final simplification78.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= n 7.6e+56)
(* (cos M) (exp (+ t_0 (- (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) l))))
(* (cos M) (exp (- t_0 (+ (* 0.5 (* n (+ 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 <= 7.6e+56) {
tmp = cos(M) * exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l)));
} else {
tmp = cos(M) * exp((t_0 - ((0.5 * (n * (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 <= 7.6d+56) then
tmp = cos(m_1) * exp((t_0 + (((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) - l)))
else
tmp = cos(m_1) * exp((t_0 - ((0.5d0 * (n * (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 <= 7.6e+56) {
tmp = Math.cos(M) * Math.exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l)));
} else {
tmp = Math.cos(M) * Math.exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if n <= 7.6e+56: tmp = math.cos(M) * math.exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))) else: tmp = math.cos(M) * math.exp((t_0 - ((0.5 * (n * (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 <= 7.6e+56) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) - l)))); else tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(Float64(0.5 * Float64(n * 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 <= 7.6e+56) tmp = cos(M) * exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))); else tmp = cos(M) * exp((t_0 - ((0.5 * (n * (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, 7.6e+56], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(N[(n + N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(N[(0.5 * N[(n * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;n \leq 7.6 \cdot 10^{+56}:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(0.5 \cdot \left(n \cdot \left(m + n \cdot 0.5\right)\right) + \ell\right)}\\
\end{array}
\end{array}
if n < 7.59999999999999991e56Initial program 79.6%
associate-/l*79.6%
exp-diff37.3%
sub-neg37.3%
exp-sum29.6%
associate-/r*29.6%
exp-diff34.9%
exp-diff79.6%
sub-neg79.6%
remove-double-neg79.6%
fabs-sub79.6%
Simplified79.6%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in n around 0 81.2%
+-commutative81.2%
unpow281.2%
distribute-rgt-out86.5%
*-commutative86.5%
*-commutative86.5%
Simplified86.5%
if 7.59999999999999991e56 < n Initial program 60.4%
associate-/l*60.4%
exp-diff0.0%
sub-neg0.0%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
exp-diff60.4%
sub-neg60.4%
remove-double-neg60.4%
fabs-sub60.4%
Simplified60.4%
Taylor expanded in K around 0 97.9%
cos-neg97.9%
Simplified97.9%
Taylor expanded in m around 0 81.3%
+-commutative54.2%
unpow254.2%
distribute-rgt-out56.3%
*-commutative56.3%
*-commutative56.3%
Simplified89.7%
Taylor expanded in M around 0 89.7%
Final simplification87.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= n 5e+56)
(* (cos M) (exp (+ t_0 (- (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) l))))
(*
(cos M)
(exp (+ t_0 (- (* (- (* n 0.5) M) (- (- M (* n 0.5)) m)) l)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (n <= 5e+56) {
tmp = cos(M) * exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l)));
} else {
tmp = cos(M) * exp((t_0 + ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - 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+56) then
tmp = cos(m_1) * exp((t_0 + (((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) - l)))
else
tmp = cos(m_1) * exp((t_0 + ((((n * 0.5d0) - m_1) * ((m_1 - (n * 0.5d0)) - m)) - 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+56) {
tmp = Math.cos(M) * Math.exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l)));
} else {
tmp = Math.cos(M) * Math.exp((t_0 + ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - l)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if n <= 5e+56: tmp = math.cos(M) * math.exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))) else: tmp = math.cos(M) * math.exp((t_0 + ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - l))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (n <= 5e+56) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) - l)))); else tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(Float64(Float64(n * 0.5) - M) * Float64(Float64(M - Float64(n * 0.5)) - m)) - 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+56) tmp = cos(M) * exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))); else tmp = cos(M) * exp((t_0 + ((((n * 0.5) - M) * ((M - (n * 0.5)) - m)) - 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+56], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(N[(n + N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(N[(N[(n * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision] - m), $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^{+56}:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(\left(n \cdot 0.5 - M\right) \cdot \left(\left(M - n \cdot 0.5\right) - m\right) - \ell\right)}\\
\end{array}
\end{array}
if n < 5.00000000000000024e56Initial program 79.6%
associate-/l*79.6%
exp-diff37.3%
sub-neg37.3%
exp-sum29.6%
associate-/r*29.6%
exp-diff34.9%
exp-diff79.6%
sub-neg79.6%
remove-double-neg79.6%
fabs-sub79.6%
Simplified79.6%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in n around 0 81.2%
+-commutative81.2%
unpow281.2%
distribute-rgt-out86.5%
*-commutative86.5%
*-commutative86.5%
Simplified86.5%
if 5.00000000000000024e56 < n Initial program 60.4%
associate-/l*60.4%
exp-diff0.0%
sub-neg0.0%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
exp-diff60.4%
sub-neg60.4%
remove-double-neg60.4%
fabs-sub60.4%
Simplified60.4%
Taylor expanded in K around 0 97.9%
cos-neg97.9%
Simplified97.9%
Taylor expanded in m around 0 81.3%
+-commutative54.2%
unpow254.2%
distribute-rgt-out56.3%
*-commutative56.3%
*-commutative56.3%
Simplified89.7%
Final simplification87.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= M -4.8)
(* (cos M) (exp (+ t_0 (- (* M (- n M)) l))))
(if (<= M 82000.0)
(* (cos M) (exp (- t_0 (+ (* 0.5 (* n (+ m (* n 0.5)))) l))))
(* (cos M) (exp (+ (- t_0 l) (* M (- m M)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (M <= -4.8) {
tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l)));
} else if (M <= 82000.0) {
tmp = cos(M) * exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l)));
} else {
tmp = cos(M) * exp(((t_0 - l) + (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) :: t_0
real(8) :: tmp
t_0 = abs((n - m))
if (m_1 <= (-4.8d0)) then
tmp = cos(m_1) * exp((t_0 + ((m_1 * (n - m_1)) - l)))
else if (m_1 <= 82000.0d0) then
tmp = cos(m_1) * exp((t_0 - ((0.5d0 * (n * (m + (n * 0.5d0)))) + l)))
else
tmp = cos(m_1) * exp(((t_0 - l) + (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 t_0 = Math.abs((n - m));
double tmp;
if (M <= -4.8) {
tmp = Math.cos(M) * Math.exp((t_0 + ((M * (n - M)) - l)));
} else if (M <= 82000.0) {
tmp = Math.cos(M) * Math.exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l)));
} else {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (M * (m - M))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if M <= -4.8: tmp = math.cos(M) * math.exp((t_0 + ((M * (n - M)) - l))) elif M <= 82000.0: tmp = math.cos(M) * math.exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l))) else: tmp = math.cos(M) * math.exp(((t_0 - l) + (M * (m - M)))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (M <= -4.8) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(M * Float64(n - M)) - l)))); elseif (M <= 82000.0) tmp = Float64(cos(M) * exp(Float64(t_0 - Float64(Float64(0.5 * Float64(n * Float64(m + Float64(n * 0.5)))) + l)))); else tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(M * Float64(m - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (M <= -4.8) tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l))); elseif (M <= 82000.0) tmp = cos(M) * exp((t_0 - ((0.5 * (n * (m + (n * 0.5)))) + l))); else tmp = cos(M) * exp(((t_0 - l) + (M * (m - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -4.8], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 82000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - N[(N[(0.5 * N[(n * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;M \leq -4.8:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(M \cdot \left(n - M\right) - \ell\right)}\\
\mathbf{elif}\;M \leq 82000:\\
\;\;\;\;\cos M \cdot e^{t_0 - \left(0.5 \cdot \left(n \cdot \left(m + n \cdot 0.5\right)\right) + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(t_0 - \ell\right) + M \cdot \left(m - M\right)}\\
\end{array}
\end{array}
if M < -4.79999999999999982Initial program 77.1%
associate-/l*77.1%
exp-diff31.2%
sub-neg31.2%
exp-sum23.0%
associate-/r*23.0%
exp-diff27.9%
exp-diff77.1%
sub-neg77.1%
remove-double-neg77.1%
fabs-sub77.1%
Simplified77.1%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in n around 0 80.7%
+-commutative80.7%
unpow280.7%
distribute-rgt-out90.6%
*-commutative90.6%
*-commutative90.6%
Simplified90.6%
Taylor expanded in m around 0 87.4%
associate-*r*87.4%
neg-mul-187.4%
Simplified87.4%
if -4.79999999999999982 < M < 82000Initial program 75.0%
associate-/l*75.1%
exp-diff26.7%
sub-neg26.7%
exp-sum21.9%
associate-/r*21.9%
exp-diff23.5%
exp-diff75.1%
sub-neg75.1%
remove-double-neg75.1%
fabs-sub75.1%
Simplified75.1%
Taylor expanded in K around 0 96.3%
cos-neg96.3%
Simplified96.3%
Taylor expanded in m around 0 65.8%
+-commutative54.8%
unpow254.8%
distribute-rgt-out55.6%
*-commutative55.6%
*-commutative55.6%
Simplified69.0%
Taylor expanded in M around 0 69.0%
if 82000 < M Initial program 76.8%
associate-/l*76.8%
exp-diff36.2%
sub-neg36.2%
exp-sum29.0%
associate-/r*29.0%
exp-diff37.7%
exp-diff76.8%
sub-neg76.8%
remove-double-neg76.8%
fabs-sub76.8%
Simplified76.8%
Taylor expanded in m around 0 69.6%
+-commutative69.6%
unpow269.6%
distribute-rgt-out72.5%
*-commutative72.5%
*-commutative72.5%
Simplified72.5%
Taylor expanded in n around 0 68.3%
associate--r+68.3%
associate-*r*68.3%
neg-mul-168.3%
cancel-sign-sub68.3%
Simplified68.3%
Taylor expanded in K around 0 90.0%
cos-neg100.0%
Simplified90.0%
Final simplification79.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= M -1.2e-10)
(* (cos M) (exp (+ t_0 (- (* M (- n M)) l))))
(if (<= M 6e-11)
(* (cos M) (exp (+ t_0 (- (* n (- M (* m 0.5))) l))))
(* (cos M) (exp (+ (- t_0 l) (* M (- m M)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (M <= -1.2e-10) {
tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l)));
} else if (M <= 6e-11) {
tmp = cos(M) * exp((t_0 + ((n * (M - (m * 0.5))) - l)));
} else {
tmp = cos(M) * exp(((t_0 - l) + (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) :: t_0
real(8) :: tmp
t_0 = abs((n - m))
if (m_1 <= (-1.2d-10)) then
tmp = cos(m_1) * exp((t_0 + ((m_1 * (n - m_1)) - l)))
else if (m_1 <= 6d-11) then
tmp = cos(m_1) * exp((t_0 + ((n * (m_1 - (m * 0.5d0))) - l)))
else
tmp = cos(m_1) * exp(((t_0 - l) + (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 t_0 = Math.abs((n - m));
double tmp;
if (M <= -1.2e-10) {
tmp = Math.cos(M) * Math.exp((t_0 + ((M * (n - M)) - l)));
} else if (M <= 6e-11) {
tmp = Math.cos(M) * Math.exp((t_0 + ((n * (M - (m * 0.5))) - l)));
} else {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (M * (m - M))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if M <= -1.2e-10: tmp = math.cos(M) * math.exp((t_0 + ((M * (n - M)) - l))) elif M <= 6e-11: tmp = math.cos(M) * math.exp((t_0 + ((n * (M - (m * 0.5))) - l))) else: tmp = math.cos(M) * math.exp(((t_0 - l) + (M * (m - M)))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (M <= -1.2e-10) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(M * Float64(n - M)) - l)))); elseif (M <= 6e-11) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(n * Float64(M - Float64(m * 0.5))) - l)))); else tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(M * Float64(m - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (M <= -1.2e-10) tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l))); elseif (M <= 6e-11) tmp = cos(M) * exp((t_0 + ((n * (M - (m * 0.5))) - l))); else tmp = cos(M) * exp(((t_0 - l) + (M * (m - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -1.2e-10], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 6e-11], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;M \leq -1.2 \cdot 10^{-10}:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(M \cdot \left(n - M\right) - \ell\right)}\\
\mathbf{elif}\;M \leq 6 \cdot 10^{-11}:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(n \cdot \left(M - m \cdot 0.5\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(t_0 - \ell\right) + M \cdot \left(m - M\right)}\\
\end{array}
\end{array}
if M < -1.2e-10Initial program 75.0%
associate-/l*75.0%
exp-diff31.3%
sub-neg31.3%
exp-sum23.5%
associate-/r*23.5%
exp-diff28.2%
exp-diff75.0%
sub-neg75.0%
remove-double-neg75.0%
fabs-sub75.0%
Simplified75.0%
Taylor expanded in K around 0 97.2%
cos-neg97.2%
Simplified97.2%
Taylor expanded in n around 0 80.0%
+-commutative80.0%
unpow280.0%
distribute-rgt-out91.0%
*-commutative91.0%
*-commutative91.0%
Simplified91.0%
Taylor expanded in m around 0 84.9%
associate-*r*84.9%
neg-mul-184.9%
Simplified84.9%
if -1.2e-10 < M < 6e-11Initial program 76.8%
associate-/l*77.0%
exp-diff27.0%
sub-neg27.0%
exp-sum22.0%
associate-/r*22.0%
exp-diff23.6%
exp-diff77.0%
sub-neg77.0%
remove-double-neg77.0%
fabs-sub77.0%
Simplified77.0%
Taylor expanded in K around 0 97.0%
cos-neg97.0%
Simplified97.0%
Taylor expanded in n around 0 64.1%
+-commutative64.1%
unpow264.1%
distribute-rgt-out66.6%
*-commutative66.6%
*-commutative66.6%
Simplified66.6%
Taylor expanded in n around inf 40.4%
if 6e-11 < M Initial program 75.4%
associate-/l*75.4%
exp-diff35.1%
sub-neg35.1%
exp-sum28.2%
associate-/r*28.2%
exp-diff36.5%
exp-diff75.4%
sub-neg75.4%
remove-double-neg75.4%
fabs-sub75.4%
Simplified75.4%
Taylor expanded in m around 0 68.5%
+-commutative68.5%
unpow268.5%
distribute-rgt-out71.3%
*-commutative71.3%
*-commutative71.3%
Simplified71.3%
Taylor expanded in n around 0 65.8%
associate--r+65.8%
associate-*r*65.8%
neg-mul-165.8%
cancel-sign-sub65.8%
Simplified65.8%
Taylor expanded in K around 0 86.3%
cos-neg98.6%
Simplified86.3%
Final simplification64.4%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (or (<= M -6.8e+25) (not (<= M 6e-60)))
(* (cos M) (exp (+ t_0 (* M (- m M)))))
(* (cos M) (exp (- t_0 l))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if ((M <= -6.8e+25) || !(M <= 6e-60)) {
tmp = cos(M) * exp((t_0 + (M * (m - M))));
} else {
tmp = cos(M) * exp((t_0 - 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 ((m_1 <= (-6.8d+25)) .or. (.not. (m_1 <= 6d-60))) then
tmp = cos(m_1) * exp((t_0 + (m_1 * (m - m_1))))
else
tmp = cos(m_1) * exp((t_0 - 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 ((M <= -6.8e+25) || !(M <= 6e-60)) {
tmp = Math.cos(M) * Math.exp((t_0 + (M * (m - M))));
} else {
tmp = Math.cos(M) * Math.exp((t_0 - l));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if (M <= -6.8e+25) or not (M <= 6e-60): tmp = math.cos(M) * math.exp((t_0 + (M * (m - M)))) else: tmp = math.cos(M) * math.exp((t_0 - l)) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if ((M <= -6.8e+25) || !(M <= 6e-60)) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(M * Float64(m - M))))); else tmp = Float64(cos(M) * exp(Float64(t_0 - l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if ((M <= -6.8e+25) || ~((M <= 6e-60))) tmp = cos(M) * exp((t_0 + (M * (m - M)))); else tmp = cos(M) * exp((t_0 - l)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[Or[LessEqual[M, -6.8e+25], N[Not[LessEqual[M, 6e-60]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 - l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;M \leq -6.8 \cdot 10^{+25} \lor \neg \left(M \leq 6 \cdot 10^{-60}\right):\\
\;\;\;\;\cos M \cdot e^{t_0 + M \cdot \left(m - M\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{t_0 - \ell}\\
\end{array}
\end{array}
if M < -6.79999999999999967e25 or 6.00000000000000038e-60 < M Initial program 75.2%
associate-/l*75.2%
exp-diff30.5%
sub-neg30.5%
exp-sum25.2%
associate-/r*25.2%
exp-diff31.3%
exp-diff75.2%
sub-neg75.2%
remove-double-neg75.2%
fabs-sub75.2%
Simplified75.2%
Taylor expanded in m around 0 65.4%
+-commutative65.4%
unpow265.4%
distribute-rgt-out70.0%
*-commutative70.0%
*-commutative70.0%
Simplified70.0%
Taylor expanded in n around 0 63.3%
associate--r+63.3%
associate-*r*63.3%
neg-mul-163.3%
cancel-sign-sub63.3%
Simplified63.3%
Taylor expanded in K around 0 79.1%
cos-neg98.5%
Simplified79.1%
Taylor expanded in l around 0 77.6%
if -6.79999999999999967e25 < M < 6.00000000000000038e-60Initial program 76.8%
associate-/l*76.9%
exp-diff30.1%
sub-neg30.1%
exp-sum22.9%
associate-/r*22.9%
exp-diff25.3%
exp-diff76.9%
sub-neg76.9%
remove-double-neg76.9%
fabs-sub76.9%
Simplified76.9%
Taylor expanded in m around 0 57.1%
+-commutative57.1%
unpow257.1%
distribute-rgt-out57.9%
*-commutative57.9%
*-commutative57.9%
Simplified57.9%
Taylor expanded in n around 0 34.1%
associate--r+34.1%
associate-*r*34.1%
neg-mul-134.1%
cancel-sign-sub34.1%
Simplified34.1%
Taylor expanded in K around 0 36.1%
cos-neg96.4%
Simplified36.1%
Taylor expanded in M around 0 33.7%
Final simplification56.3%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (fabs (- n m))))
(if (<= M -4e-101)
(* (cos M) (exp (+ t_0 (- (* M (- n M)) l))))
(* (cos M) (exp (+ (- t_0 l) (* M (- m M))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (M <= -4e-101) {
tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l)));
} else {
tmp = cos(M) * exp(((t_0 - l) + (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) :: t_0
real(8) :: tmp
t_0 = abs((n - m))
if (m_1 <= (-4d-101)) then
tmp = cos(m_1) * exp((t_0 + ((m_1 * (n - m_1)) - l)))
else
tmp = cos(m_1) * exp(((t_0 - l) + (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 t_0 = Math.abs((n - m));
double tmp;
if (M <= -4e-101) {
tmp = Math.cos(M) * Math.exp((t_0 + ((M * (n - M)) - l)));
} else {
tmp = Math.cos(M) * Math.exp(((t_0 - l) + (M * (m - M))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if M <= -4e-101: tmp = math.cos(M) * math.exp((t_0 + ((M * (n - M)) - l))) else: tmp = math.cos(M) * math.exp(((t_0 - l) + (M * (m - M)))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (M <= -4e-101) tmp = Float64(cos(M) * exp(Float64(t_0 + Float64(Float64(M * Float64(n - M)) - l)))); else tmp = Float64(cos(M) * exp(Float64(Float64(t_0 - l) + Float64(M * Float64(m - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (M <= -4e-101) tmp = cos(M) * exp((t_0 + ((M * (n - M)) - l))); else tmp = cos(M) * exp(((t_0 - l) + (M * (m - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -4e-101], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(t$95$0 + N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(t$95$0 - l), $MachinePrecision] + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;M \leq -4 \cdot 10^{-101}:\\
\;\;\;\;\cos M \cdot e^{t_0 + \left(M \cdot \left(n - M\right) - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(t_0 - \ell\right) + M \cdot \left(m - M\right)}\\
\end{array}
\end{array}
if M < -4.00000000000000021e-101Initial program 76.0%
associate-/l*76.2%
exp-diff30.6%
sub-neg30.6%
exp-sum23.0%
associate-/r*23.0%
exp-diff28.1%
exp-diff76.2%
sub-neg76.2%
remove-double-neg76.2%
fabs-sub76.2%
Simplified76.2%
Taylor expanded in K around 0 96.5%
cos-neg96.5%
Simplified96.5%
Taylor expanded in n around 0 72.6%
+-commutative72.6%
unpow272.6%
distribute-rgt-out82.8%
*-commutative82.8%
*-commutative82.8%
Simplified82.8%
Taylor expanded in m around 0 75.3%
associate-*r*75.3%
neg-mul-175.3%
Simplified75.3%
if -4.00000000000000021e-101 < M Initial program 76.0%
associate-/l*76.0%
exp-diff30.2%
sub-neg30.2%
exp-sum24.5%
associate-/r*24.5%
exp-diff28.5%
exp-diff76.0%
sub-neg76.0%
remove-double-neg76.0%
fabs-sub76.0%
Simplified76.0%
Taylor expanded in m around 0 59.2%
+-commutative59.2%
unpow259.2%
distribute-rgt-out60.9%
*-commutative60.9%
*-commutative60.9%
Simplified60.9%
Taylor expanded in n around 0 43.7%
associate--r+43.7%
associate-*r*43.7%
neg-mul-143.7%
cancel-sign-sub43.7%
Simplified43.7%
Taylor expanded in K around 0 53.5%
cos-neg98.0%
Simplified53.5%
Final simplification60.2%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (+ (- (fabs (- m n)) l) (* M (- m M))))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((m - n)) - l) + (M * (m - 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) * exp(((abs((m - n)) - l) + (m_1 * (m - m_1))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) + (M * (m - M))));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((m - n)) - l) + (M * (m - M))))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) + Float64(M * Float64(m - M))))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) + (M * (m - M)))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) + M \cdot \left(m - M\right)}
\end{array}
Initial program 76.0%
associate-/l*76.0%
exp-diff30.3%
sub-neg30.3%
exp-sum24.1%
associate-/r*24.1%
exp-diff28.4%
exp-diff76.0%
sub-neg76.0%
remove-double-neg76.0%
fabs-sub76.0%
Simplified76.0%
Taylor expanded in m around 0 61.4%
+-commutative61.4%
unpow261.4%
distribute-rgt-out64.1%
*-commutative64.1%
*-commutative64.1%
Simplified64.1%
Taylor expanded in n around 0 49.1%
associate--r+49.1%
associate-*r*49.1%
neg-mul-149.1%
cancel-sign-sub49.1%
Simplified49.1%
Taylor expanded in K around 0 58.3%
cos-neg97.5%
Simplified58.3%
Final simplification58.3%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (fabs (- m n)) l))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((fabs((m - n)) - 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((m - n)) - 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((m - n)) - l));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((math.fabs((m - n)) - l))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(abs(Float64(m - n)) - l))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((abs((m - n)) - l)); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left|m - n\right| - \ell}
\end{array}
Initial program 76.0%
associate-/l*76.0%
exp-diff30.3%
sub-neg30.3%
exp-sum24.1%
associate-/r*24.1%
exp-diff28.4%
exp-diff76.0%
sub-neg76.0%
remove-double-neg76.0%
fabs-sub76.0%
Simplified76.0%
Taylor expanded in m around 0 61.4%
+-commutative61.4%
unpow261.4%
distribute-rgt-out64.1%
*-commutative64.1%
*-commutative64.1%
Simplified64.1%
Taylor expanded in n around 0 49.1%
associate--r+49.1%
associate-*r*49.1%
neg-mul-149.1%
cancel-sign-sub49.1%
Simplified49.1%
Taylor expanded in K around 0 58.3%
cos-neg97.5%
Simplified58.3%
Taylor expanded in M around 0 24.9%
Final simplification24.9%
herbie shell --seed 2023309
(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)))))))