
(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
(let* ((t_0 (- (fabs (- m n)) l))
(t_1 (exp (- t_0 (pow (- (/ (+ m n) 2.0) M) 2.0))))
(t_2 (* (+ m n) 0.5)))
(if (<= (* (cos (- (/ (* K (+ m n)) 2.0) M)) t_1) -1e-24)
(*
t_1
(cos
(-
(/ (/ (* K (+ (pow m 3.0) (pow n 3.0))) (fma m m (* n (- n m)))) 2.0)
M)))
(exp (+ (* (- t_2 M) (- M t_2)) t_0)))))
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 t_2 = (m + n) * 0.5;
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * t_1) <= -1e-24) {
tmp = t_1 * cos(((((K * (pow(m, 3.0) + pow(n, 3.0))) / fma(m, m, (n * (n - m)))) / 2.0) - M));
} else {
tmp = exp((((t_2 - M) * (M - t_2)) + t_0));
}
return tmp;
}
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))) t_2 = Float64(Float64(m + n) * 0.5) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * t_1) <= -1e-24) tmp = Float64(t_1 * cos(Float64(Float64(Float64(Float64(K * Float64((m ^ 3.0) + (n ^ 3.0))) / fma(m, m, Float64(n * Float64(n - m)))) / 2.0) - M))); else tmp = exp(Float64(Float64(Float64(t_2 - M) * Float64(M - t_2)) + t_0)); end return tmp end
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]}, Block[{t$95$2 = N[(N[(m + n), $MachinePrecision] * 0.5), $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], -1e-24], N[(t$95$1 * N[Cos[N[(N[(N[(N[(K * N[(N[Power[m, 3.0], $MachinePrecision] + N[Power[n, 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / N[(m * m + N[(n * N[(n - m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[(t$95$2 - M), $MachinePrecision] * N[(M - t$95$2), $MachinePrecision]), $MachinePrecision] + t$95$0), $MachinePrecision]], $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|m - n\right| - \ell\\
t_1 := e^{t\_0 - {\left(\frac{m + n}{2} - M\right)}^{2}}\\
t_2 := \left(m + n\right) \cdot 0.5\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot t\_1 \leq -1 \cdot 10^{-24}:\\
\;\;\;\;t\_1 \cdot \cos \left(\frac{\frac{K \cdot \left({m}^{3} + {n}^{3}\right)}{\mathsf{fma}\left(m, m, n \cdot \left(n - m\right)\right)}}{2} - M\right)\\
\mathbf{else}:\\
\;\;\;\;e^{\left(t\_2 - M\right) \cdot \left(M - t\_2\right) + t\_0}\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) < -9.99999999999999924e-25Initial program 59.5%
*-commutative59.5%
flip3-+59.6%
associate-*l/74.0%
fma-define74.0%
distribute-rgt-out--74.0%
Applied egg-rr74.0%
if -9.99999999999999924e-25 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 77.8%
unpow277.8%
div-inv77.8%
metadata-eval77.8%
div-inv77.8%
metadata-eval77.8%
Applied egg-rr77.8%
Taylor expanded in m around 0 86.3%
Taylor expanded in M around 0 86.0%
Taylor expanded in K around 0 98.6%
Final simplification97.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (+ m n) 0.5))
(t_1 (- (fabs (- m n)) l))
(t_2 (exp (+ (* (- t_0 M) (- M t_0)) t_1))))
(if (<=
(*
(cos (- (/ (* K (+ m n)) 2.0) M))
(exp (- t_1 (pow (- (/ (+ m n) 2.0) M) 2.0))))
1.0)
(* t_2 (cos (- (/ (* K n) 2.0) M)))
t_2)))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double t_1 = fabs((m - n)) - l;
double t_2 = exp((((t_0 - M) * (M - t_0)) + t_1));
double tmp;
if ((cos((((K * (m + n)) / 2.0) - M)) * exp((t_1 - pow((((m + n) / 2.0) - M), 2.0)))) <= 1.0) {
tmp = t_2 * cos((((K * n) / 2.0) - M));
} else {
tmp = t_2;
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: t_1
real(8) :: t_2
real(8) :: tmp
t_0 = (m + n) * 0.5d0
t_1 = abs((m - n)) - l
t_2 = exp((((t_0 - m_1) * (m_1 - t_0)) + t_1))
if ((cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((t_1 - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))) <= 1.0d0) then
tmp = t_2 * cos((((k * n) / 2.0d0) - m_1))
else
tmp = t_2
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double t_1 = Math.abs((m - n)) - l;
double t_2 = Math.exp((((t_0 - M) * (M - t_0)) + t_1));
double tmp;
if ((Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((t_1 - Math.pow((((m + n) / 2.0) - M), 2.0)))) <= 1.0) {
tmp = t_2 * Math.cos((((K * n) / 2.0) - M));
} else {
tmp = t_2;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (m + n) * 0.5 t_1 = math.fabs((m - n)) - l t_2 = math.exp((((t_0 - M) * (M - t_0)) + t_1)) tmp = 0 if (math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((t_1 - math.pow((((m + n) / 2.0) - M), 2.0)))) <= 1.0: tmp = t_2 * math.cos((((K * n) / 2.0) - M)) else: tmp = t_2 return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(m + n) * 0.5) t_1 = Float64(abs(Float64(m - n)) - l) t_2 = exp(Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) + t_1)) tmp = 0.0 if (Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(t_1 - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) <= 1.0) tmp = Float64(t_2 * cos(Float64(Float64(Float64(K * n) / 2.0) - M))); else tmp = t_2; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (m + n) * 0.5; t_1 = abs((m - n)) - l; t_2 = exp((((t_0 - M) * (M - t_0)) + t_1)); tmp = 0.0; if ((cos((((K * (m + n)) / 2.0) - M)) * exp((t_1 - ((((m + n) / 2.0) - M) ^ 2.0)))) <= 1.0) tmp = t_2 * cos((((K * n) / 2.0) - M)); else tmp = t_2; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]}, Block[{t$95$2 = N[Exp[N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] + t$95$1), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(t$95$1 - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], 1.0], N[(t$95$2 * N[Cos[N[(N[(N[(K * n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$2]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5\\
t_1 := \left|m - n\right| - \ell\\
t_2 := e^{\left(t\_0 - M\right) \cdot \left(M - t\_0\right) + t\_1}\\
\mathbf{if}\;\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{t\_1 - {\left(\frac{m + n}{2} - M\right)}^{2}} \leq 1:\\
\;\;\;\;t\_2 \cdot \cos \left(\frac{K \cdot n}{2} - M\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) < 1Initial program 96.7%
unpow296.7%
div-inv96.7%
metadata-eval96.7%
div-inv96.7%
metadata-eval96.7%
Applied egg-rr96.7%
Taylor expanded in m around 0 96.8%
if 1 < (*.f64 (cos.f64 (-.f64 (/.f64 (*.f64 K (+.f64 m n)) #s(literal 2 binary64)) M)) (exp.f64 (-.f64 (neg.f64 (pow.f64 (-.f64 (/.f64 (+.f64 m n) #s(literal 2 binary64)) M) #s(literal 2 binary64))) (-.f64 l (fabs.f64 (-.f64 m n)))))) Initial program 16.1%
unpow216.1%
div-inv16.1%
metadata-eval16.1%
div-inv16.1%
metadata-eval16.1%
Applied egg-rr16.1%
Taylor expanded in m around 0 50.0%
Taylor expanded in M around 0 50.0%
Taylor expanded in K around 0 100.0%
Final simplification97.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- (* M (- M n)) (+ n l))))))
(if (<= M -58000000000.0)
(* (cos M) (exp (* n M)))
(if (<= M -1.1e-90)
t_0
(if (<= M -3.8e-140)
(* (cos M) (exp (* n (- M (* m 0.5)))))
(if (<= M 2.7e+82)
t_0
(*
(cos (- (* K (* m 0.5)) M))
(exp (* n (+ (* m 0.5) (- -1.0 M)))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(((M * (M - n)) - (n + l)));
double tmp;
if (M <= -58000000000.0) {
tmp = cos(M) * exp((n * M));
} else if (M <= -1.1e-90) {
tmp = t_0;
} else if (M <= -3.8e-140) {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
} else if (M <= 2.7e+82) {
tmp = t_0;
} else {
tmp = cos(((K * (m * 0.5)) - M)) * exp((n * ((m * 0.5) + (-1.0 - 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 = cos(m_1) * exp(((m_1 * (m_1 - n)) - (n + l)))
if (m_1 <= (-58000000000.0d0)) then
tmp = cos(m_1) * exp((n * m_1))
else if (m_1 <= (-1.1d-90)) then
tmp = t_0
else if (m_1 <= (-3.8d-140)) then
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
else if (m_1 <= 2.7d+82) then
tmp = t_0
else
tmp = cos(((k * (m * 0.5d0)) - m_1)) * exp((n * ((m * 0.5d0) + ((-1.0d0) - 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.cos(M) * Math.exp(((M * (M - n)) - (n + l)));
double tmp;
if (M <= -58000000000.0) {
tmp = Math.cos(M) * Math.exp((n * M));
} else if (M <= -1.1e-90) {
tmp = t_0;
} else if (M <= -3.8e-140) {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
} else if (M <= 2.7e+82) {
tmp = t_0;
} else {
tmp = Math.cos(((K * (m * 0.5)) - M)) * Math.exp((n * ((m * 0.5) + (-1.0 - M))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(((M * (M - n)) - (n + l))) tmp = 0 if M <= -58000000000.0: tmp = math.cos(M) * math.exp((n * M)) elif M <= -1.1e-90: tmp = t_0 elif M <= -3.8e-140: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) elif M <= 2.7e+82: tmp = t_0 else: tmp = math.cos(((K * (m * 0.5)) - M)) * math.exp((n * ((m * 0.5) + (-1.0 - M)))) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(Float64(M * Float64(M - n)) - Float64(n + l)))) tmp = 0.0 if (M <= -58000000000.0) tmp = Float64(cos(M) * exp(Float64(n * M))); elseif (M <= -1.1e-90) tmp = t_0; elseif (M <= -3.8e-140) tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); elseif (M <= 2.7e+82) tmp = t_0; else tmp = Float64(cos(Float64(Float64(K * Float64(m * 0.5)) - M)) * exp(Float64(n * Float64(Float64(m * 0.5) + Float64(-1.0 - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(((M * (M - n)) - (n + l))); tmp = 0.0; if (M <= -58000000000.0) tmp = cos(M) * exp((n * M)); elseif (M <= -1.1e-90) tmp = t_0; elseif (M <= -3.8e-140) tmp = cos(M) * exp((n * (M - (m * 0.5)))); elseif (M <= 2.7e+82) tmp = t_0; else tmp = cos(((K * (m * 0.5)) - M)) * exp((n * ((m * 0.5) + (-1.0 - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(M * N[(M - n), $MachinePrecision]), $MachinePrecision] - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -58000000000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, -1.1e-90], t$95$0, If[LessEqual[M, -3.8e-140], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 2.7e+82], t$95$0, N[(N[Cos[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(n * N[(N[(m * 0.5), $MachinePrecision] + N[(-1.0 - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{M \cdot \left(M - n\right) - \left(n + \ell\right)}\\
\mathbf{if}\;M \leq -58000000000:\\
\;\;\;\;\cos M \cdot e^{n \cdot M}\\
\mathbf{elif}\;M \leq -1.1 \cdot 10^{-90}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq -3.8 \cdot 10^{-140}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{elif}\;M \leq 2.7 \cdot 10^{+82}:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos \left(K \cdot \left(m \cdot 0.5\right) - M\right) \cdot e^{n \cdot \left(m \cdot 0.5 + \left(-1 - M\right)\right)}\\
\end{array}
\end{array}
if M < -5.8e10Initial program 76.7%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in n around 0 76.7%
+-commutative76.7%
unpow276.7%
distribute-rgt-out93.4%
*-commutative93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in n around inf 42.9%
Taylor expanded in M around inf 44.6%
*-commutative44.6%
Simplified44.6%
if -5.8e10 < M < -1.09999999999999993e-90 or -3.79999999999999998e-140 < M < 2.6999999999999999e82Initial program 78.1%
*-un-lft-identity78.1%
*-commutative78.1%
Applied egg-rr25.5%
Taylor expanded in n around 0 39.6%
+-commutative39.6%
unpow239.6%
distribute-rgt-out40.3%
Simplified40.3%
Taylor expanded in n around 0 41.7%
*-commutative41.7%
associate-*l*41.7%
Simplified41.7%
Taylor expanded in m around 0 53.4%
cos-neg53.4%
associate-*r*53.4%
neg-mul-153.4%
+-commutative53.4%
Simplified53.4%
if -1.09999999999999993e-90 < M < -3.79999999999999998e-140Initial program 60.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 70.5%
+-commutative70.5%
unpow270.5%
distribute-rgt-out70.5%
*-commutative70.5%
*-commutative70.5%
Simplified70.5%
Taylor expanded in n around inf 70.6%
if 2.6999999999999999e82 < M Initial program 78.7%
*-un-lft-identity78.7%
*-commutative78.7%
Applied egg-rr3.3%
Taylor expanded in n around 0 3.2%
+-commutative3.2%
unpow23.2%
distribute-rgt-out7.5%
Simplified7.5%
Taylor expanded in n around 0 9.7%
*-commutative9.7%
associate-*l*9.7%
Simplified9.7%
Taylor expanded in n around inf 28.8%
+-commutative28.8%
Simplified28.8%
Final simplification47.5%
(FPCore (K m n M l)
:precision binary64
(if (<= M -6000000000000.0)
(* (cos M) (exp (* n M)))
(if (or (<= M -9.8e-91) (and (not (<= M -3.8e-140)) (<= M 3e+87)))
(* (cos M) (exp (- (* M (- M n)) (+ n l))))
(* (cos M) (exp (* n (- M (* m 0.5))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -6000000000000.0) {
tmp = cos(M) * exp((n * M));
} else if ((M <= -9.8e-91) || (!(M <= -3.8e-140) && (M <= 3e+87))) {
tmp = cos(M) * exp(((M * (M - n)) - (n + l)));
} else {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m_1 <= (-6000000000000.0d0)) then
tmp = cos(m_1) * exp((n * m_1))
else if ((m_1 <= (-9.8d-91)) .or. (.not. (m_1 <= (-3.8d-140))) .and. (m_1 <= 3d+87)) then
tmp = cos(m_1) * exp(((m_1 * (m_1 - n)) - (n + l)))
else
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -6000000000000.0) {
tmp = Math.cos(M) * Math.exp((n * M));
} else if ((M <= -9.8e-91) || (!(M <= -3.8e-140) && (M <= 3e+87))) {
tmp = Math.cos(M) * Math.exp(((M * (M - n)) - (n + l)));
} else {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= -6000000000000.0: tmp = math.cos(M) * math.exp((n * M)) elif (M <= -9.8e-91) or (not (M <= -3.8e-140) and (M <= 3e+87)): tmp = math.cos(M) * math.exp(((M * (M - n)) - (n + l))) else: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= -6000000000000.0) tmp = Float64(cos(M) * exp(Float64(n * M))); elseif ((M <= -9.8e-91) || (!(M <= -3.8e-140) && (M <= 3e+87))) tmp = Float64(cos(M) * exp(Float64(Float64(M * Float64(M - n)) - Float64(n + l)))); else tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= -6000000000000.0) tmp = cos(M) * exp((n * M)); elseif ((M <= -9.8e-91) || (~((M <= -3.8e-140)) && (M <= 3e+87))) tmp = cos(M) * exp(((M * (M - n)) - (n + l))); else tmp = cos(M) * exp((n * (M - (m * 0.5)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, -6000000000000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[Or[LessEqual[M, -9.8e-91], And[N[Not[LessEqual[M, -3.8e-140]], $MachinePrecision], LessEqual[M, 3e+87]]], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(M * N[(M - n), $MachinePrecision]), $MachinePrecision] - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -6000000000000:\\
\;\;\;\;\cos M \cdot e^{n \cdot M}\\
\mathbf{elif}\;M \leq -9.8 \cdot 10^{-91} \lor \neg \left(M \leq -3.8 \cdot 10^{-140}\right) \land M \leq 3 \cdot 10^{+87}:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(M - n\right) - \left(n + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\end{array}
\end{array}
if M < -6e12Initial program 76.7%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in n around 0 76.7%
+-commutative76.7%
unpow276.7%
distribute-rgt-out93.4%
*-commutative93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in n around inf 42.9%
Taylor expanded in M around inf 44.6%
*-commutative44.6%
Simplified44.6%
if -6e12 < M < -9.7999999999999996e-91 or -3.79999999999999998e-140 < M < 2.9999999999999999e87Initial program 78.1%
*-un-lft-identity78.1%
*-commutative78.1%
Applied egg-rr25.5%
Taylor expanded in n around 0 39.6%
+-commutative39.6%
unpow239.6%
distribute-rgt-out40.3%
Simplified40.3%
Taylor expanded in n around 0 41.7%
*-commutative41.7%
associate-*l*41.7%
Simplified41.7%
Taylor expanded in m around 0 53.4%
cos-neg53.4%
associate-*r*53.4%
neg-mul-153.4%
+-commutative53.4%
Simplified53.4%
if -9.7999999999999996e-91 < M < -3.79999999999999998e-140 or 2.9999999999999999e87 < M Initial program 75.4%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 82.5%
+-commutative82.5%
unpow282.5%
distribute-rgt-out89.6%
*-commutative89.6%
*-commutative89.6%
Simplified89.6%
Taylor expanded in n around inf 55.3%
Final simplification51.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- (* K (* m 0.5)) M))))
(if (<= M -27000000000.0)
(* (cos M) (exp (* n M)))
(if (<= M 1e-58)
(* t_0 (exp (- (- m n) (+ l (* M (- n M))))))
(* t_0 (exp (+ (- m n) (- (* n (- (* m 0.5) M)) l))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(((K * (m * 0.5)) - M));
double tmp;
if (M <= -27000000000.0) {
tmp = cos(M) * exp((n * M));
} else if (M <= 1e-58) {
tmp = t_0 * exp(((m - n) - (l + (M * (n - M)))));
} else {
tmp = t_0 * exp(((m - n) + ((n * ((m * 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 = cos(((k * (m * 0.5d0)) - m_1))
if (m_1 <= (-27000000000.0d0)) then
tmp = cos(m_1) * exp((n * m_1))
else if (m_1 <= 1d-58) then
tmp = t_0 * exp(((m - n) - (l + (m_1 * (n - m_1)))))
else
tmp = t_0 * exp(((m - n) + ((n * ((m * 0.5d0) - m_1)) - 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.cos(((K * (m * 0.5)) - M));
double tmp;
if (M <= -27000000000.0) {
tmp = Math.cos(M) * Math.exp((n * M));
} else if (M <= 1e-58) {
tmp = t_0 * Math.exp(((m - n) - (l + (M * (n - M)))));
} else {
tmp = t_0 * Math.exp(((m - n) + ((n * ((m * 0.5) - M)) - l)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(((K * (m * 0.5)) - M)) tmp = 0 if M <= -27000000000.0: tmp = math.cos(M) * math.exp((n * M)) elif M <= 1e-58: tmp = t_0 * math.exp(((m - n) - (l + (M * (n - M))))) else: tmp = t_0 * math.exp(((m - n) + ((n * ((m * 0.5) - M)) - l))) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(Float64(K * Float64(m * 0.5)) - M)) tmp = 0.0 if (M <= -27000000000.0) tmp = Float64(cos(M) * exp(Float64(n * M))); elseif (M <= 1e-58) tmp = Float64(t_0 * exp(Float64(Float64(m - n) - Float64(l + Float64(M * Float64(n - M)))))); else tmp = Float64(t_0 * exp(Float64(Float64(m - n) + Float64(Float64(n * Float64(Float64(m * 0.5) - M)) - l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(((K * (m * 0.5)) - M)); tmp = 0.0; if (M <= -27000000000.0) tmp = cos(M) * exp((n * M)); elseif (M <= 1e-58) tmp = t_0 * exp(((m - n) - (l + (M * (n - M))))); else tmp = t_0 * exp(((m - n) + ((n * ((m * 0.5) - M)) - l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -27000000000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1e-58], N[(t$95$0 * N[Exp[N[(N[(m - n), $MachinePrecision] - N[(l + N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Exp[N[(N[(m - n), $MachinePrecision] + N[(N[(n * N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot \left(m \cdot 0.5\right) - M\right)\\
\mathbf{if}\;M \leq -27000000000:\\
\;\;\;\;\cos M \cdot e^{n \cdot M}\\
\mathbf{elif}\;M \leq 10^{-58}:\\
\;\;\;\;t\_0 \cdot e^{\left(m - n\right) - \left(\ell + M \cdot \left(n - M\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot e^{\left(m - n\right) + \left(n \cdot \left(m \cdot 0.5 - M\right) - \ell\right)}\\
\end{array}
\end{array}
if M < -2.7e10Initial program 76.7%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in n around 0 76.7%
+-commutative76.7%
unpow276.7%
distribute-rgt-out93.4%
*-commutative93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in n around inf 42.9%
Taylor expanded in M around inf 44.6%
*-commutative44.6%
Simplified44.6%
if -2.7e10 < M < 1e-58Initial program 77.3%
*-un-lft-identity77.3%
*-commutative77.3%
Applied egg-rr24.2%
Taylor expanded in n around 0 37.2%
+-commutative37.2%
unpow237.2%
distribute-rgt-out38.0%
Simplified38.0%
Taylor expanded in n around 0 38.8%
*-commutative38.8%
associate-*l*38.8%
Simplified38.8%
Taylor expanded in m around 0 54.3%
associate-*r*54.3%
neg-mul-154.3%
Simplified54.3%
if 1e-58 < M Initial program 77.3%
*-un-lft-identity77.3%
*-commutative77.3%
Applied egg-rr10.4%
Taylor expanded in n around 0 16.8%
+-commutative16.8%
unpow216.8%
distribute-rgt-out19.6%
Simplified19.6%
Taylor expanded in n around 0 23.6%
*-commutative23.6%
associate-*l*23.6%
Simplified23.6%
Taylor expanded in n around inf 43.5%
Final simplification48.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (cos (- (* K (* m 0.5)) M))))
(if (<= M -31000000000000.0)
(* (cos M) (exp (* n M)))
(if (<= M 1.35e+110)
(* t_0 (exp (- (- m n) (+ l (* M (- n M))))))
(* t_0 (exp (* n (+ (* m 0.5) (- -1.0 M)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(((K * (m * 0.5)) - M));
double tmp;
if (M <= -31000000000000.0) {
tmp = cos(M) * exp((n * M));
} else if (M <= 1.35e+110) {
tmp = t_0 * exp(((m - n) - (l + (M * (n - M)))));
} else {
tmp = t_0 * exp((n * ((m * 0.5) + (-1.0 - 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 = cos(((k * (m * 0.5d0)) - m_1))
if (m_1 <= (-31000000000000.0d0)) then
tmp = cos(m_1) * exp((n * m_1))
else if (m_1 <= 1.35d+110) then
tmp = t_0 * exp(((m - n) - (l + (m_1 * (n - m_1)))))
else
tmp = t_0 * exp((n * ((m * 0.5d0) + ((-1.0d0) - 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.cos(((K * (m * 0.5)) - M));
double tmp;
if (M <= -31000000000000.0) {
tmp = Math.cos(M) * Math.exp((n * M));
} else if (M <= 1.35e+110) {
tmp = t_0 * Math.exp(((m - n) - (l + (M * (n - M)))));
} else {
tmp = t_0 * Math.exp((n * ((m * 0.5) + (-1.0 - M))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(((K * (m * 0.5)) - M)) tmp = 0 if M <= -31000000000000.0: tmp = math.cos(M) * math.exp((n * M)) elif M <= 1.35e+110: tmp = t_0 * math.exp(((m - n) - (l + (M * (n - M))))) else: tmp = t_0 * math.exp((n * ((m * 0.5) + (-1.0 - M)))) return tmp
function code(K, m, n, M, l) t_0 = cos(Float64(Float64(K * Float64(m * 0.5)) - M)) tmp = 0.0 if (M <= -31000000000000.0) tmp = Float64(cos(M) * exp(Float64(n * M))); elseif (M <= 1.35e+110) tmp = Float64(t_0 * exp(Float64(Float64(m - n) - Float64(l + Float64(M * Float64(n - M)))))); else tmp = Float64(t_0 * exp(Float64(n * Float64(Float64(m * 0.5) + Float64(-1.0 - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(((K * (m * 0.5)) - M)); tmp = 0.0; if (M <= -31000000000000.0) tmp = cos(M) * exp((n * M)); elseif (M <= 1.35e+110) tmp = t_0 * exp(((m - n) - (l + (M * (n - M))))); else tmp = t_0 * exp((n * ((m * 0.5) + (-1.0 - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Cos[N[(N[(K * N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[M, -31000000000000.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 1.35e+110], N[(t$95$0 * N[Exp[N[(N[(m - n), $MachinePrecision] - N[(l + N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(t$95$0 * N[Exp[N[(n * N[(N[(m * 0.5), $MachinePrecision] + N[(-1.0 - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot \left(m \cdot 0.5\right) - M\right)\\
\mathbf{if}\;M \leq -31000000000000:\\
\;\;\;\;\cos M \cdot e^{n \cdot M}\\
\mathbf{elif}\;M \leq 1.35 \cdot 10^{+110}:\\
\;\;\;\;t\_0 \cdot e^{\left(m - n\right) - \left(\ell + M \cdot \left(n - M\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0 \cdot e^{n \cdot \left(m \cdot 0.5 + \left(-1 - M\right)\right)}\\
\end{array}
\end{array}
if M < -3.1e13Initial program 76.7%
Taylor expanded in K around 0 98.3%
cos-neg98.3%
Simplified98.3%
Taylor expanded in n around 0 76.7%
+-commutative76.7%
unpow276.7%
distribute-rgt-out93.4%
*-commutative93.4%
*-commutative93.4%
Simplified93.4%
Taylor expanded in n around inf 42.9%
Taylor expanded in M around inf 44.6%
*-commutative44.6%
Simplified44.6%
if -3.1e13 < M < 1.35000000000000005e110Initial program 77.0%
*-un-lft-identity77.0%
*-commutative77.0%
Applied egg-rr23.7%
Taylor expanded in n around 0 37.1%
+-commutative37.1%
unpow237.1%
distribute-rgt-out37.8%
Simplified37.8%
Taylor expanded in n around 0 39.7%
*-commutative39.7%
associate-*l*39.7%
Simplified39.7%
Taylor expanded in m around 0 53.1%
associate-*r*53.1%
neg-mul-153.1%
Simplified53.1%
if 1.35000000000000005e110 < M Initial program 78.6%
*-un-lft-identity78.6%
*-commutative78.6%
Applied egg-rr1.2%
Taylor expanded in n around 0 1.0%
+-commutative1.0%
unpow21.0%
distribute-rgt-out5.9%
Simplified5.9%
Taylor expanded in n around 0 8.4%
*-commutative8.4%
associate-*l*8.4%
Simplified8.4%
Taylor expanded in n around inf 32.0%
+-commutative32.0%
Simplified32.0%
Final simplification47.7%
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (* (+ m n) 0.5))) (exp (+ (* (- t_0 M) (- M t_0)) (- (fabs (- m n)) l)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
return exp((((t_0 - M) * (M - t_0)) + (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
real(8) :: t_0
t_0 = (m + n) * 0.5d0
code = exp((((t_0 - m_1) * (m_1 - t_0)) + (abs((m - n)) - l)))
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
return Math.exp((((t_0 - M) * (M - t_0)) + (Math.abs((m - n)) - l)));
}
def code(K, m, n, M, l): t_0 = (m + n) * 0.5 return math.exp((((t_0 - M) * (M - t_0)) + (math.fabs((m - n)) - l)))
function code(K, m, n, M, l) t_0 = Float64(Float64(m + n) * 0.5) return exp(Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) + Float64(abs(Float64(m - n)) - l))) end
function tmp = code(K, m, n, M, l) t_0 = (m + n) * 0.5; tmp = exp((((t_0 - M) * (M - t_0)) + (abs((m - n)) - l))); end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]}, N[Exp[N[(N[(N[(t$95$0 - M), $MachinePrecision] * N[(M - t$95$0), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5\\
e^{\left(t\_0 - M\right) \cdot \left(M - t\_0\right) + \left(\left|m - n\right| - \ell\right)}
\end{array}
\end{array}
Initial program 77.2%
unpow277.2%
div-inv77.2%
metadata-eval77.2%
div-inv77.2%
metadata-eval77.2%
Applied egg-rr77.2%
Taylor expanded in m around 0 85.4%
Taylor expanded in M around 0 84.8%
Taylor expanded in K around 0 95.6%
Final simplification95.6%
(FPCore (K m n M l) :precision binary64 (if (<= M -7.5e-84) (* (cos M) (exp (* n M))) (* (cos M) (exp (* n (- M (* m 0.5)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -7.5e-84) {
tmp = cos(M) * exp((n * M));
} else {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m_1 <= (-7.5d-84)) then
tmp = cos(m_1) * exp((n * m_1))
else
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -7.5e-84) {
tmp = Math.cos(M) * Math.exp((n * M));
} else {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= -7.5e-84: tmp = math.cos(M) * math.exp((n * M)) else: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= -7.5e-84) tmp = Float64(cos(M) * exp(Float64(n * M))); else tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= -7.5e-84) tmp = cos(M) * exp((n * M)); else tmp = cos(M) * exp((n * (M - (m * 0.5)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, -7.5e-84], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -7.5 \cdot 10^{-84}:\\
\;\;\;\;\cos M \cdot e^{n \cdot M}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\end{array}
\end{array}
if M < -7.50000000000000026e-84Initial program 79.5%
Taylor expanded in K around 0 98.8%
cos-neg98.8%
Simplified98.8%
Taylor expanded in n around 0 71.3%
+-commutative71.3%
unpow271.3%
distribute-rgt-out84.6%
*-commutative84.6%
*-commutative84.6%
Simplified84.6%
Taylor expanded in n around inf 37.8%
Taylor expanded in M around inf 41.4%
*-commutative41.4%
Simplified41.4%
if -7.50000000000000026e-84 < M Initial program 76.0%
Taylor expanded in K around 0 94.5%
cos-neg94.5%
Simplified94.5%
Taylor expanded in n around 0 72.2%
+-commutative72.2%
unpow272.2%
distribute-rgt-out77.5%
*-commutative77.5%
*-commutative77.5%
Simplified77.5%
Taylor expanded in n around inf 40.4%
Final simplification40.7%
(FPCore (K m n M l) :precision binary64 (if (<= M -3.9e-92) (* (cos M) (exp (* n M))) (* (cos M) (exp (* n (* m -0.5))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -3.9e-92) {
tmp = cos(M) * exp((n * M));
} else {
tmp = cos(M) * exp((n * (m * -0.5)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m_1 <= (-3.9d-92)) then
tmp = cos(m_1) * exp((n * m_1))
else
tmp = cos(m_1) * exp((n * (m * (-0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= -3.9e-92) {
tmp = Math.cos(M) * Math.exp((n * M));
} else {
tmp = Math.cos(M) * Math.exp((n * (m * -0.5)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= -3.9e-92: tmp = math.cos(M) * math.exp((n * M)) else: tmp = math.cos(M) * math.exp((n * (m * -0.5))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= -3.9e-92) tmp = Float64(cos(M) * exp(Float64(n * M))); else tmp = Float64(cos(M) * exp(Float64(n * Float64(m * -0.5)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= -3.9e-92) tmp = cos(M) * exp((n * M)); else tmp = cos(M) * exp((n * (m * -0.5))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, -3.9e-92], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(m * -0.5), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -3.9 \cdot 10^{-92}:\\
\;\;\;\;\cos M \cdot e^{n \cdot M}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(m \cdot -0.5\right)}\\
\end{array}
\end{array}
if M < -3.8999999999999997e-92Initial program 78.6%
Taylor expanded in K around 0 98.8%
cos-neg98.8%
Simplified98.8%
Taylor expanded in n around 0 70.5%
+-commutative70.5%
unpow270.5%
distribute-rgt-out83.6%
*-commutative83.6%
*-commutative83.6%
Simplified83.6%
Taylor expanded in n around inf 38.6%
Taylor expanded in M around inf 42.1%
*-commutative42.1%
Simplified42.1%
if -3.8999999999999997e-92 < M Initial program 76.5%
Taylor expanded in K around 0 94.5%
cos-neg94.5%
Simplified94.5%
Taylor expanded in n around 0 72.6%
+-commutative72.6%
unpow272.6%
distribute-rgt-out77.9%
*-commutative77.9%
*-commutative77.9%
Simplified77.9%
Taylor expanded in n around inf 40.1%
Taylor expanded in M around 0 31.7%
associate-*r*31.7%
*-commutative31.7%
Simplified31.7%
Final simplification35.1%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (* n M))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((n * 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((n * m_1))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((n * M));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((n * M))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(n * M))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((n * M)); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{n \cdot M}
\end{array}
Initial program 77.2%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in n around 0 71.9%
+-commutative71.9%
unpow271.9%
distribute-rgt-out79.8%
*-commutative79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in n around inf 39.6%
Taylor expanded in M around inf 33.7%
*-commutative33.7%
Simplified33.7%
Final simplification33.7%
(FPCore (K m n M l) :precision binary64 (* (cos M) (+ 1.0 (* n (- M (* m 0.5))))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * (1.0 + (n * (M - (m * 0.5))));
}
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) * (1.0d0 + (n * (m_1 - (m * 0.5d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * (1.0 + (n * (M - (m * 0.5))));
}
def code(K, m, n, M, l): return math.cos(M) * (1.0 + (n * (M - (m * 0.5))))
function code(K, m, n, M, l) return Float64(cos(M) * Float64(1.0 + Float64(n * Float64(M - Float64(m * 0.5))))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * (1.0 + (n * (M - (m * 0.5)))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[(1.0 + N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot \left(1 + n \cdot \left(M - m \cdot 0.5\right)\right)
\end{array}
Initial program 77.2%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in n around 0 71.9%
+-commutative71.9%
unpow271.9%
distribute-rgt-out79.8%
*-commutative79.8%
*-commutative79.8%
Simplified79.8%
Taylor expanded in n around inf 39.6%
Taylor expanded in n around 0 6.1%
Final simplification6.1%
herbie shell --seed 2024074
(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)))))))