
(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 10 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(Float64(abs(Float64(n - m)) - 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[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 79.6%
associate-/l*80.0%
+-commutative80.0%
fabs-sub80.0%
+-commutative80.0%
Simplified80.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 (<= n 1.25e-146)
(*
-0.5
(*
(* n K)
(*
(exp (+ t_0 (- (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) l)))
(- (sin M)))))
(if (<= n 54.0)
(* (cos (- (/ K (/ 2.0 n)) M)) (exp (+ (* M (- n M)) (- t_0 l))))
(* (cos M) (exp (* -0.25 (* n n))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = fabs((n - m));
double tmp;
if (n <= 1.25e-146) {
tmp = -0.5 * ((n * K) * (exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))) * -sin(M)));
} else if (n <= 54.0) {
tmp = cos(((K / (2.0 / n)) - M)) * exp(((M * (n - M)) + (t_0 - l)));
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
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 <= 1.25d-146) then
tmp = (-0.5d0) * ((n * k) * (exp((t_0 + (((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) - l))) * -sin(m_1)))
else if (n <= 54.0d0) then
tmp = cos(((k / (2.0d0 / n)) - m_1)) * exp(((m_1 * (n - m_1)) + (t_0 - l)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
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 <= 1.25e-146) {
tmp = -0.5 * ((n * K) * (Math.exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))) * -Math.sin(M)));
} else if (n <= 54.0) {
tmp = Math.cos(((K / (2.0 / n)) - M)) * Math.exp(((M * (n - M)) + (t_0 - l)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.fabs((n - m)) tmp = 0 if n <= 1.25e-146: tmp = -0.5 * ((n * K) * (math.exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))) * -math.sin(M))) elif n <= 54.0: tmp = math.cos(((K / (2.0 / n)) - M)) * math.exp(((M * (n - M)) + (t_0 - l))) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) t_0 = abs(Float64(n - m)) tmp = 0.0 if (n <= 1.25e-146) tmp = Float64(-0.5 * Float64(Float64(n * K) * Float64(exp(Float64(t_0 + Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) - l))) * Float64(-sin(M))))); elseif (n <= 54.0) tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / n)) - M)) * exp(Float64(Float64(M * Float64(n - M)) + Float64(t_0 - l)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = abs((n - m)); tmp = 0.0; if (n <= 1.25e-146) tmp = -0.5 * ((n * K) * (exp((t_0 + (((n + ((m * 0.5) - M)) * (M - (m * 0.5))) - l))) * -sin(M))); elseif (n <= 54.0) tmp = cos(((K / (2.0 / n)) - M)) * exp(((M * (n - M)) + (t_0 - l))); else tmp = cos(M) * exp((-0.25 * (n * n))); 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, 1.25e-146], N[(-0.5 * N[(N[(n * K), $MachinePrecision] * N[(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] * (-N[Sin[M], $MachinePrecision])), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], N[(N[Cos[N[(N[(K / N[(2.0 / n), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(M * N[(n - M), $MachinePrecision]), $MachinePrecision] + N[(t$95$0 - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left|n - m\right|\\
\mathbf{if}\;n \leq 1.25 \cdot 10^{-146}:\\
\;\;\;\;-0.5 \cdot \left(\left(n \cdot K\right) \cdot \left(e^{t_0 + \left(\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) - \ell\right)} \cdot \left(-\sin M\right)\right)\right)\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{n}} - M\right) \cdot e^{M \cdot \left(n - M\right) + \left(t_0 - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 1.24999999999999989e-146Initial program 85.3%
associate-/l*85.9%
+-commutative85.9%
fabs-sub85.9%
+-commutative85.9%
Simplified85.9%
Taylor expanded in n around 0 72.2%
+-commutative72.2%
unpow272.2%
distribute-rgt-out73.5%
*-commutative73.5%
*-commutative73.5%
Simplified73.5%
Taylor expanded in m around 0 80.4%
Taylor expanded in K around 0 79.5%
cos-neg79.5%
Simplified79.5%
Taylor expanded in K around inf 76.4%
Simplified73.9%
if 1.24999999999999989e-146 < n < 54Initial program 83.3%
associate-/l*83.3%
+-commutative83.3%
fabs-sub83.3%
+-commutative83.3%
Simplified83.3%
Taylor expanded in n around 0 83.3%
+-commutative83.3%
unpow283.3%
distribute-rgt-out83.3%
*-commutative83.3%
*-commutative83.3%
Simplified83.3%
Taylor expanded in m around 0 93.3%
Taylor expanded in m around 0 67.1%
mul-1-neg67.1%
distribute-rgt-neg-in67.1%
Simplified67.1%
if 54 < n Initial program 64.7%
associate-/l*64.7%
+-commutative64.7%
fabs-sub64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in n around inf 94.2%
unpow294.2%
Applied egg-rr94.2%
Final simplification78.5%
(FPCore (K m n M l)
:precision binary64
(if (<= n 290.0)
(*
(cos (- (/ K (/ 2.0 n)) M))
(exp (+ (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) (- (fabs (- n m)) l))))
(* (cos M) (exp (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 290.0) {
tmp = cos(((K / (2.0 / n)) - M)) * exp((((n + ((m * 0.5) - M)) * (M - (m * 0.5))) + (fabs((n - m)) - l)));
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
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 (n <= 290.0d0) then
tmp = cos(((k / (2.0d0 / n)) - m_1)) * exp((((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) + (abs((n - m)) - l)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 290.0) {
tmp = Math.cos(((K / (2.0 / n)) - M)) * Math.exp((((n + ((m * 0.5) - M)) * (M - (m * 0.5))) + (Math.abs((n - m)) - l)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 290.0: tmp = math.cos(((K / (2.0 / n)) - M)) * math.exp((((n + ((m * 0.5) - M)) * (M - (m * 0.5))) + (math.fabs((n - m)) - l))) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 290.0) tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / n)) - M)) * exp(Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) + Float64(abs(Float64(n - m)) - l)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 290.0) tmp = cos(((K / (2.0 / n)) - M)) * exp((((n + ((m * 0.5) - M)) * (M - (m * 0.5))) + (abs((n - m)) - l))); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 290.0], N[(N[Cos[N[(N[(K / N[(2.0 / n), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[(n + N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision]), $MachinePrecision] * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 290:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{n}} - M\right) \cdot e^{\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) + \left(\left|n - m\right| - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 290Initial program 85.0%
associate-/l*85.5%
+-commutative85.5%
fabs-sub85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in n around 0 73.9%
+-commutative73.9%
unpow273.9%
distribute-rgt-out75.0%
*-commutative75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in m around 0 82.5%
if 290 < n Initial program 64.7%
associate-/l*64.7%
+-commutative64.7%
fabs-sub64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in n around inf 94.2%
unpow294.2%
Applied egg-rr94.2%
Final simplification85.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- (pow M 2.0)))))
(t_1 (exp (- (- (fabs (- n m)) l) (* (* m 0.5) (+ n (* m 0.5)))))))
(if (<= n 4.1e-235)
t_1
(if (<= n 3.5e-201)
t_0
(if (<= n 1.05e-49)
t_1
(if (<= n 54.0) t_0 (* (cos M) (exp (* -0.25 (* n n))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-pow(M, 2.0));
double t_1 = exp(((fabs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5)))));
double tmp;
if (n <= 4.1e-235) {
tmp = t_1;
} else if (n <= 3.5e-201) {
tmp = t_0;
} else if (n <= 1.05e-49) {
tmp = t_1;
} else if (n <= 54.0) {
tmp = t_0;
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
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) :: tmp
t_0 = cos(m_1) * exp(-(m_1 ** 2.0d0))
t_1 = exp(((abs((n - m)) - l) - ((m * 0.5d0) * (n + (m * 0.5d0)))))
if (n <= 4.1d-235) then
tmp = t_1
else if (n <= 3.5d-201) then
tmp = t_0
else if (n <= 1.05d-49) then
tmp = t_1
else if (n <= 54.0d0) then
tmp = t_0
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
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(-Math.pow(M, 2.0));
double t_1 = Math.exp(((Math.abs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5)))));
double tmp;
if (n <= 4.1e-235) {
tmp = t_1;
} else if (n <= 3.5e-201) {
tmp = t_0;
} else if (n <= 1.05e-49) {
tmp = t_1;
} else if (n <= 54.0) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-math.pow(M, 2.0)) t_1 = math.exp(((math.fabs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5))))) tmp = 0 if n <= 4.1e-235: tmp = t_1 elif n <= 3.5e-201: tmp = t_0 elif n <= 1.05e-49: tmp = t_1 elif n <= 54.0: tmp = t_0 else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) t_1 = exp(Float64(Float64(abs(Float64(n - m)) - l) - Float64(Float64(m * 0.5) * Float64(n + Float64(m * 0.5))))) tmp = 0.0 if (n <= 4.1e-235) tmp = t_1; elseif (n <= 3.5e-201) tmp = t_0; elseif (n <= 1.05e-49) tmp = t_1; elseif (n <= 54.0) tmp = t_0; else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-(M ^ 2.0)); t_1 = exp(((abs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5))))); tmp = 0.0; if (n <= 4.1e-235) tmp = t_1; elseif (n <= 3.5e-201) tmp = t_0; elseif (n <= 1.05e-49) tmp = t_1; elseif (n <= 54.0) tmp = t_0; else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(N[(m * 0.5), $MachinePrecision] * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, 4.1e-235], t$95$1, If[LessEqual[n, 3.5e-201], t$95$0, If[LessEqual[n, 1.05e-49], t$95$1, If[LessEqual[n, 54.0], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-{M}^{2}}\\
t_1 := e^{\left(\left|n - m\right| - \ell\right) - \left(m \cdot 0.5\right) \cdot \left(n + m \cdot 0.5\right)}\\
\mathbf{if}\;n \leq 4.1 \cdot 10^{-235}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq 3.5 \cdot 10^{-201}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 1.05 \cdot 10^{-49}:\\
\;\;\;\;t_1\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;t_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 4.09999999999999997e-235 or 3.50000000000000008e-201 < n < 1.0499999999999999e-49Initial program 84.7%
associate-/l*85.2%
+-commutative85.2%
fabs-sub85.2%
+-commutative85.2%
Simplified85.2%
Taylor expanded in n around 0 72.5%
+-commutative72.5%
unpow272.5%
distribute-rgt-out73.7%
*-commutative73.7%
*-commutative73.7%
Simplified73.7%
Taylor expanded in m around 0 80.8%
Taylor expanded in K around 0 81.1%
cos-neg81.1%
Simplified81.1%
Taylor expanded in M around 0 72.2%
associate--r+72.2%
associate-*r*72.2%
*-commutative72.2%
*-commutative72.2%
Simplified72.2%
if 4.09999999999999997e-235 < n < 3.50000000000000008e-201 or 1.0499999999999999e-49 < n < 54Initial program 88.2%
associate-/l*88.2%
+-commutative88.2%
fabs-sub88.2%
+-commutative88.2%
Simplified88.2%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 77.2%
mul-1-neg77.2%
Simplified77.2%
if 54 < n Initial program 64.7%
associate-/l*64.7%
+-commutative64.7%
fabs-sub64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in n around inf 94.2%
unpow294.2%
Applied egg-rr94.2%
Final simplification78.4%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (- (- (fabs (- n m)) l) (* (* m 0.5) (+ n (* m 0.5))))))
(t_1 (exp (- (pow M 2.0)))))
(if (<= n 9e-235)
t_0
(if (<= n 3.2e-161)
(* (cos (- (/ K (/ 2.0 n)) M)) t_1)
(if (<= n 3.2e-49)
t_0
(if (<= n 54.0)
(* (cos M) t_1)
(* (cos M) (exp (* -0.25 (* n n))))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(((fabs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5)))));
double t_1 = exp(-pow(M, 2.0));
double tmp;
if (n <= 9e-235) {
tmp = t_0;
} else if (n <= 3.2e-161) {
tmp = cos(((K / (2.0 / n)) - M)) * t_1;
} else if (n <= 3.2e-49) {
tmp = t_0;
} else if (n <= 54.0) {
tmp = cos(M) * t_1;
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
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) :: tmp
t_0 = exp(((abs((n - m)) - l) - ((m * 0.5d0) * (n + (m * 0.5d0)))))
t_1 = exp(-(m_1 ** 2.0d0))
if (n <= 9d-235) then
tmp = t_0
else if (n <= 3.2d-161) then
tmp = cos(((k / (2.0d0 / n)) - m_1)) * t_1
else if (n <= 3.2d-49) then
tmp = t_0
else if (n <= 54.0d0) then
tmp = cos(m_1) * t_1
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp(((Math.abs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5)))));
double t_1 = Math.exp(-Math.pow(M, 2.0));
double tmp;
if (n <= 9e-235) {
tmp = t_0;
} else if (n <= 3.2e-161) {
tmp = Math.cos(((K / (2.0 / n)) - M)) * t_1;
} else if (n <= 3.2e-49) {
tmp = t_0;
} else if (n <= 54.0) {
tmp = Math.cos(M) * t_1;
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(((math.fabs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5))))) t_1 = math.exp(-math.pow(M, 2.0)) tmp = 0 if n <= 9e-235: tmp = t_0 elif n <= 3.2e-161: tmp = math.cos(((K / (2.0 / n)) - M)) * t_1 elif n <= 3.2e-49: tmp = t_0 elif n <= 54.0: tmp = math.cos(M) * t_1 else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(Float64(abs(Float64(n - m)) - l) - Float64(Float64(m * 0.5) * Float64(n + Float64(m * 0.5))))) t_1 = exp(Float64(-(M ^ 2.0))) tmp = 0.0 if (n <= 9e-235) tmp = t_0; elseif (n <= 3.2e-161) tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / n)) - M)) * t_1); elseif (n <= 3.2e-49) tmp = t_0; elseif (n <= 54.0) tmp = Float64(cos(M) * t_1); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(((abs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5))))); t_1 = exp(-(M ^ 2.0)); tmp = 0.0; if (n <= 9e-235) tmp = t_0; elseif (n <= 3.2e-161) tmp = cos(((K / (2.0 / n)) - M)) * t_1; elseif (n <= 3.2e-49) tmp = t_0; elseif (n <= 54.0) tmp = cos(M) * t_1; else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(N[(m * 0.5), $MachinePrecision] * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]}, If[LessEqual[n, 9e-235], t$95$0, If[LessEqual[n, 3.2e-161], N[(N[Cos[N[(N[(K / N[(2.0 / n), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[n, 3.2e-49], t$95$0, If[LessEqual[n, 54.0], N[(N[Cos[M], $MachinePrecision] * t$95$1), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{\left(\left|n - m\right| - \ell\right) - \left(m \cdot 0.5\right) \cdot \left(n + m \cdot 0.5\right)}\\
t_1 := e^{-{M}^{2}}\\
\mathbf{if}\;n \leq 9 \cdot 10^{-235}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 3.2 \cdot 10^{-161}:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{n}} - M\right) \cdot t_1\\
\mathbf{elif}\;n \leq 3.2 \cdot 10^{-49}:\\
\;\;\;\;t_0\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;\cos M \cdot t_1\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 8.9999999999999996e-235 or 3.19999999999999985e-161 < n < 3.20000000000000002e-49Initial program 85.6%
associate-/l*86.2%
+-commutative86.2%
fabs-sub86.2%
+-commutative86.2%
Simplified86.2%
Taylor expanded in n around 0 72.9%
+-commutative72.9%
unpow272.9%
distribute-rgt-out74.2%
*-commutative74.2%
*-commutative74.2%
Simplified74.2%
Taylor expanded in m around 0 80.3%
Taylor expanded in K around 0 80.7%
cos-neg80.7%
Simplified80.7%
Taylor expanded in M around 0 72.5%
associate--r+72.5%
associate-*r*72.5%
*-commutative72.5%
*-commutative72.5%
Simplified72.5%
if 8.9999999999999996e-235 < n < 3.19999999999999985e-161Initial program 77.6%
associate-/l*77.6%
+-commutative77.6%
fabs-sub77.6%
+-commutative77.6%
Simplified77.6%
Taylor expanded in m around 0 95.2%
Taylor expanded in M around inf 72.4%
mul-1-neg72.4%
Simplified72.4%
Taylor expanded in m around 0 72.4%
if 3.20000000000000002e-49 < n < 54Initial program 87.5%
associate-/l*87.5%
+-commutative87.5%
fabs-sub87.5%
+-commutative87.5%
Simplified87.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 87.9%
mul-1-neg87.9%
Simplified87.9%
if 54 < n Initial program 64.7%
associate-/l*64.7%
+-commutative64.7%
fabs-sub64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in n around inf 94.2%
unpow294.2%
Applied egg-rr94.2%
Final simplification78.7%
(FPCore (K m n M l) :precision binary64 (if (<= n 54.0) (exp (- (- (fabs (- n m)) l) (* (* m 0.5) (+ n (* m 0.5))))) (* (cos M) (exp (* -0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 54.0) {
tmp = exp(((fabs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5)))));
} else {
tmp = cos(M) * exp((-0.25 * (n * n)));
}
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 (n <= 54.0d0) then
tmp = exp(((abs((n - m)) - l) - ((m * 0.5d0) * (n + (m * 0.5d0)))))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 54.0) {
tmp = Math.exp(((Math.abs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5)))));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 54.0: tmp = math.exp(((math.fabs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5))))) else: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 54.0) tmp = exp(Float64(Float64(abs(Float64(n - m)) - l) - Float64(Float64(m * 0.5) * Float64(n + Float64(m * 0.5))))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 54.0) tmp = exp(((abs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5))))); else tmp = cos(M) * exp((-0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 54.0], N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(N[(m * 0.5), $MachinePrecision] * N[(n + N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 54:\\
\;\;\;\;e^{\left(\left|n - m\right| - \ell\right) - \left(m \cdot 0.5\right) \cdot \left(n + m \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\end{array}
\end{array}
if n < 54Initial program 85.0%
associate-/l*85.5%
+-commutative85.5%
fabs-sub85.5%
+-commutative85.5%
Simplified85.5%
Taylor expanded in n around 0 73.9%
+-commutative73.9%
unpow273.9%
distribute-rgt-out75.0%
*-commutative75.0%
*-commutative75.0%
Simplified75.0%
Taylor expanded in m around 0 82.5%
Taylor expanded in K around 0 82.8%
cos-neg82.8%
Simplified82.8%
Taylor expanded in M around 0 71.6%
associate--r+71.6%
associate-*r*71.6%
*-commutative71.6%
*-commutative71.6%
Simplified71.6%
if 54 < n Initial program 64.7%
associate-/l*64.7%
+-commutative64.7%
fabs-sub64.7%
+-commutative64.7%
Simplified64.7%
Taylor expanded in K around 0 98.5%
cos-neg98.5%
Simplified98.5%
Taylor expanded in n around inf 94.2%
unpow294.2%
Applied egg-rr94.2%
Final simplification77.6%
(FPCore (K m n M l)
:precision binary64
(if (<= l -4.8e+19)
(* (cos M) (exp l))
(if (<= l 1.3)
(* (cos M) (exp (* -0.25 (* n n))))
(* (cos M) (exp (- l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -4.8e+19) {
tmp = cos(M) * exp(l);
} else if (l <= 1.3) {
tmp = cos(M) * exp((-0.25 * (n * n)));
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= (-4.8d+19)) then
tmp = cos(m_1) * exp(l)
else if (l <= 1.3d0) then
tmp = cos(m_1) * exp(((-0.25d0) * (n * n)))
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -4.8e+19) {
tmp = Math.cos(M) * Math.exp(l);
} else if (l <= 1.3) {
tmp = Math.cos(M) * Math.exp((-0.25 * (n * n)));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -4.8e+19: tmp = math.cos(M) * math.exp(l) elif l <= 1.3: tmp = math.cos(M) * math.exp((-0.25 * (n * n))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -4.8e+19) tmp = Float64(cos(M) * exp(l)); elseif (l <= 1.3) tmp = Float64(cos(M) * exp(Float64(-0.25 * Float64(n * n)))); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= -4.8e+19) tmp = cos(M) * exp(l); elseif (l <= 1.3) tmp = cos(M) * exp((-0.25 * (n * n))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -4.8e+19], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 1.3], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -4.8 \cdot 10^{+19}:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 1.3:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -4.8e19Initial program 78.3%
associate-/l*80.0%
+-commutative80.0%
fabs-sub80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in l around inf 24.5%
mul-1-neg24.5%
Simplified24.5%
expm1-log1p-u24.2%
expm1-udef24.2%
add-sqr-sqrt24.2%
sqrt-unprod24.2%
sqr-neg24.2%
sqrt-unprod0.0%
add-sqr-sqrt73.8%
Applied egg-rr73.8%
expm1-def73.8%
expm1-log1p73.8%
Simplified73.8%
if -4.8e19 < l < 1.30000000000000004Initial program 79.1%
associate-/l*79.1%
+-commutative79.1%
fabs-sub79.1%
+-commutative79.1%
Simplified79.1%
Taylor expanded in K around 0 96.6%
cos-neg96.6%
Simplified96.6%
Taylor expanded in n around inf 53.4%
unpow253.4%
Applied egg-rr53.4%
if 1.30000000000000004 < l Initial program 81.8%
associate-/l*81.8%
+-commutative81.8%
fabs-sub81.8%
+-commutative81.8%
Simplified81.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 98.5%
mul-1-neg98.5%
Simplified98.5%
Final simplification69.8%
(FPCore (K m n M l) :precision binary64 (if (<= l -1e-172) (* (cos M) (exp l)) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -1e-172) {
tmp = cos(M) * exp(l);
} else {
tmp = cos(M) * exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= (-1d-172)) then
tmp = cos(m_1) * exp(l)
else
tmp = cos(m_1) * exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -1e-172) {
tmp = Math.cos(M) * Math.exp(l);
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -1e-172: tmp = math.cos(M) * math.exp(l) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -1e-172) tmp = Float64(cos(M) * exp(l)); else tmp = Float64(cos(M) * exp(Float64(-l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= -1e-172) tmp = cos(M) * exp(l); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -1e-172], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -1 \cdot 10^{-172}:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -1e-172Initial program 78.9%
associate-/l*80.0%
+-commutative80.0%
fabs-sub80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in K around 0 95.0%
cos-neg95.0%
Simplified95.0%
Taylor expanded in l around inf 17.2%
mul-1-neg17.2%
Simplified17.2%
expm1-log1p-u16.9%
expm1-udef16.9%
add-sqr-sqrt16.9%
sqrt-unprod16.9%
sqr-neg16.9%
sqrt-unprod0.0%
add-sqr-sqrt51.1%
Applied egg-rr51.1%
expm1-def51.1%
expm1-log1p51.1%
Simplified51.1%
if -1e-172 < l Initial program 80.0%
associate-/l*80.0%
+-commutative80.0%
fabs-sub80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in K around 0 98.9%
cos-neg98.9%
Simplified98.9%
Taylor expanded in l around inf 49.0%
mul-1-neg49.0%
Simplified49.0%
Final simplification49.7%
(FPCore (K m n M l) :precision binary64 (if (<= l 1.4e-8) (* (cos M) (exp l)) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.4e-8) {
tmp = cos(M) * exp(l);
} else {
tmp = exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (l <= 1.4d-8) then
tmp = cos(m_1) * exp(l)
else
tmp = exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.4e-8) {
tmp = Math.cos(M) * Math.exp(l);
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 1.4e-8: tmp = math.cos(M) * math.exp(l) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 1.4e-8) tmp = Float64(cos(M) * exp(l)); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 1.4e-8) tmp = cos(M) * exp(l); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 1.4e-8], N[(N[Cos[M], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.4 \cdot 10^{-8}:\\
\;\;\;\;\cos M \cdot e^{\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 1.4e-8Initial program 78.7%
associate-/l*79.2%
+-commutative79.2%
fabs-sub79.2%
+-commutative79.2%
Simplified79.2%
Taylor expanded in K around 0 96.6%
cos-neg96.6%
Simplified96.6%
Taylor expanded in l around inf 16.3%
mul-1-neg16.3%
Simplified16.3%
expm1-log1p-u16.1%
expm1-udef16.1%
add-sqr-sqrt11.0%
sqrt-unprod16.1%
sqr-neg16.1%
sqrt-unprod5.1%
add-sqr-sqrt32.9%
Applied egg-rr32.9%
expm1-def32.9%
expm1-log1p32.9%
Simplified32.9%
if 1.4e-8 < l Initial program 82.1%
associate-/l*82.1%
+-commutative82.1%
fabs-sub82.1%
+-commutative82.1%
Simplified82.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 97.1%
mul-1-neg97.1%
Simplified97.1%
Taylor expanded in M around 0 97.1%
Final simplification49.7%
(FPCore (K m n M l) :precision binary64 (exp (- l)))
double code(double K, double m, double n, double M, double l) {
return exp(-l);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
def code(K, m, n, M, l): return math.exp(-l)
function code(K, m, n, M, l) return exp(Float64(-l)) end
function tmp = code(K, m, n, M, l) tmp = exp(-l); end
code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
\\
e^{-\ell}
\end{array}
Initial program 79.6%
associate-/l*80.0%
+-commutative80.0%
fabs-sub80.0%
+-commutative80.0%
Simplified80.0%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in l around inf 37.4%
mul-1-neg37.4%
Simplified37.4%
Taylor expanded in M around 0 37.4%
Final simplification37.4%
herbie shell --seed 2024020
(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)))))))