
(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 16 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 74.5%
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 (exp (- l))) (t_1 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= M -1.56e-6)
t_1
(if (<= M -1.75e-154)
(* (cos M) t_0)
(if (<= M -1.05e-296)
(* (cos M) (exp (* n (- M (* m 0.5)))))
(if (<= M 5.2e-160)
(* (* (* 0.5 K) (* n (sin M))) t_0)
(if (<= M 9e-57)
t_0
(if (<= M 27.0) (* 0.5 (* K (* m (* (sin M) t_0)))) t_1))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp(-l);
double t_1 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (M <= -1.56e-6) {
tmp = t_1;
} else if (M <= -1.75e-154) {
tmp = cos(M) * t_0;
} else if (M <= -1.05e-296) {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
} else if (M <= 5.2e-160) {
tmp = ((0.5 * K) * (n * sin(M))) * t_0;
} else if (M <= 9e-57) {
tmp = t_0;
} else if (M <= 27.0) {
tmp = 0.5 * (K * (m * (sin(M) * t_0)));
} else {
tmp = t_1;
}
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(-l)
t_1 = cos(m_1) * exp(-(m_1 ** 2.0d0))
if (m_1 <= (-1.56d-6)) then
tmp = t_1
else if (m_1 <= (-1.75d-154)) then
tmp = cos(m_1) * t_0
else if (m_1 <= (-1.05d-296)) then
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
else if (m_1 <= 5.2d-160) then
tmp = ((0.5d0 * k) * (n * sin(m_1))) * t_0
else if (m_1 <= 9d-57) then
tmp = t_0
else if (m_1 <= 27.0d0) then
tmp = 0.5d0 * (k * (m * (sin(m_1) * t_0)))
else
tmp = t_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.exp(-l);
double t_1 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double tmp;
if (M <= -1.56e-6) {
tmp = t_1;
} else if (M <= -1.75e-154) {
tmp = Math.cos(M) * t_0;
} else if (M <= -1.05e-296) {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
} else if (M <= 5.2e-160) {
tmp = ((0.5 * K) * (n * Math.sin(M))) * t_0;
} else if (M <= 9e-57) {
tmp = t_0;
} else if (M <= 27.0) {
tmp = 0.5 * (K * (m * (Math.sin(M) * t_0)));
} else {
tmp = t_1;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp(-l) t_1 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if M <= -1.56e-6: tmp = t_1 elif M <= -1.75e-154: tmp = math.cos(M) * t_0 elif M <= -1.05e-296: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) elif M <= 5.2e-160: tmp = ((0.5 * K) * (n * math.sin(M))) * t_0 elif M <= 9e-57: tmp = t_0 elif M <= 27.0: tmp = 0.5 * (K * (m * (math.sin(M) * t_0))) else: tmp = t_1 return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-l)) t_1 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (M <= -1.56e-6) tmp = t_1; elseif (M <= -1.75e-154) tmp = Float64(cos(M) * t_0); elseif (M <= -1.05e-296) tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); elseif (M <= 5.2e-160) tmp = Float64(Float64(Float64(0.5 * K) * Float64(n * sin(M))) * t_0); elseif (M <= 9e-57) tmp = t_0; elseif (M <= 27.0) tmp = Float64(0.5 * Float64(K * Float64(m * Float64(sin(M) * t_0)))); else tmp = t_1; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp(-l); t_1 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (M <= -1.56e-6) tmp = t_1; elseif (M <= -1.75e-154) tmp = cos(M) * t_0; elseif (M <= -1.05e-296) tmp = cos(M) * exp((n * (M - (m * 0.5)))); elseif (M <= 5.2e-160) tmp = ((0.5 * K) * (n * sin(M))) * t_0; elseif (M <= 9e-57) tmp = t_0; elseif (M <= 27.0) tmp = 0.5 * (K * (m * (sin(M) * t_0))); else tmp = t_1; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -1.56e-6], t$95$1, If[LessEqual[M, -1.75e-154], N[(N[Cos[M], $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[M, -1.05e-296], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 5.2e-160], N[(N[(N[(0.5 * K), $MachinePrecision] * N[(n * N[Sin[M], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$0), $MachinePrecision], If[LessEqual[M, 9e-57], t$95$0, If[LessEqual[M, 27.0], N[(0.5 * N[(K * N[(m * N[(N[Sin[M], $MachinePrecision] * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-\ell}\\
t_1 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;M \leq -1.56 \cdot 10^{-6}:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;M \leq -1.75 \cdot 10^{-154}:\\
\;\;\;\;\cos M \cdot t\_0\\
\mathbf{elif}\;M \leq -1.05 \cdot 10^{-296}:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{elif}\;M \leq 5.2 \cdot 10^{-160}:\\
\;\;\;\;\left(\left(0.5 \cdot K\right) \cdot \left(n \cdot \sin M\right)\right) \cdot t\_0\\
\mathbf{elif}\;M \leq 9 \cdot 10^{-57}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 27:\\
\;\;\;\;0.5 \cdot \left(K \cdot \left(m \cdot \left(\sin M \cdot t\_0\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if M < -1.5600000000000001e-6 or 27 < M Initial program 73.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 98.5%
mul-1-neg98.5%
Simplified98.5%
if -1.5600000000000001e-6 < M < -1.75e-154Initial program 62.6%
Taylor expanded in K around 0 96.6%
cos-neg96.6%
Simplified96.6%
Taylor expanded in l around inf 50.0%
mul-1-neg40.9%
Simplified50.0%
if -1.75e-154 < M < -1.05e-296Initial program 68.1%
Taylor expanded in n around 0 46.6%
+-commutative46.6%
unpow246.6%
distribute-rgt-out46.6%
*-commutative46.6%
*-commutative46.6%
Simplified46.6%
Taylor expanded in K around 0 63.7%
cos-neg91.4%
Simplified63.7%
Taylor expanded in n around inf 51.8%
if -1.05e-296 < M < 5.20000000000000007e-160Initial program 81.3%
Taylor expanded in K around 0 93.8%
cos-neg93.8%
*-commutative93.8%
associate-*l*93.8%
metadata-eval93.8%
distribute-rgt-neg-in93.8%
*-commutative93.8%
associate-*r*93.8%
distribute-lft-neg-in93.8%
sin-neg93.8%
distribute-rgt-neg-out93.8%
remove-double-neg93.8%
Simplified93.8%
Taylor expanded in l around inf 39.0%
mul-1-neg39.0%
Simplified39.0%
Taylor expanded in n around inf 63.6%
associate-*r*63.6%
Simplified63.6%
if 5.20000000000000007e-160 < M < 8.99999999999999945e-57Initial program 90.9%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in l around inf 47.6%
mul-1-neg47.5%
Simplified47.6%
Taylor expanded in M around 0 47.6%
if 8.99999999999999945e-57 < M < 27Initial program 83.3%
Taylor expanded in K around 0 83.3%
cos-neg83.3%
*-commutative83.3%
associate-*l*83.3%
metadata-eval83.3%
distribute-rgt-neg-in83.3%
*-commutative83.3%
associate-*r*83.3%
distribute-lft-neg-in83.3%
sin-neg83.3%
distribute-rgt-neg-out83.3%
remove-double-neg83.3%
Simplified83.3%
Taylor expanded in l around inf 51.1%
mul-1-neg51.1%
Simplified51.1%
Taylor expanded in m around inf 51.4%
Final simplification77.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* -0.25 (pow m 2.0)))))
(t_1 (exp (- l)))
(t_2 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= M -28.5)
t_2
(if (<= M 1.5e-304)
t_0
(if (<= M 3.5e-227)
(* (* (* 0.5 K) (* n (sin M))) t_1)
(if (<= M 2.4e-68)
t_0
(if (<= M 27.0) (* 0.5 (* K (* m (* (sin M) t_1)))) t_2)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((-0.25 * pow(m, 2.0)));
double t_1 = exp(-l);
double t_2 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (M <= -28.5) {
tmp = t_2;
} else if (M <= 1.5e-304) {
tmp = t_0;
} else if (M <= 3.5e-227) {
tmp = ((0.5 * K) * (n * sin(M))) * t_1;
} else if (M <= 2.4e-68) {
tmp = t_0;
} else if (M <= 27.0) {
tmp = 0.5 * (K * (m * (sin(M) * t_1)));
} 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 = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
t_1 = exp(-l)
t_2 = cos(m_1) * exp(-(m_1 ** 2.0d0))
if (m_1 <= (-28.5d0)) then
tmp = t_2
else if (m_1 <= 1.5d-304) then
tmp = t_0
else if (m_1 <= 3.5d-227) then
tmp = ((0.5d0 * k) * (n * sin(m_1))) * t_1
else if (m_1 <= 2.4d-68) then
tmp = t_0
else if (m_1 <= 27.0d0) then
tmp = 0.5d0 * (k * (m * (sin(m_1) * t_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 = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
double t_1 = Math.exp(-l);
double t_2 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double tmp;
if (M <= -28.5) {
tmp = t_2;
} else if (M <= 1.5e-304) {
tmp = t_0;
} else if (M <= 3.5e-227) {
tmp = ((0.5 * K) * (n * Math.sin(M))) * t_1;
} else if (M <= 2.4e-68) {
tmp = t_0;
} else if (M <= 27.0) {
tmp = 0.5 * (K * (m * (Math.sin(M) * t_1)));
} else {
tmp = t_2;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) t_1 = math.exp(-l) t_2 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if M <= -28.5: tmp = t_2 elif M <= 1.5e-304: tmp = t_0 elif M <= 3.5e-227: tmp = ((0.5 * K) * (n * math.sin(M))) * t_1 elif M <= 2.4e-68: tmp = t_0 elif M <= 27.0: tmp = 0.5 * (K * (m * (math.sin(M) * t_1))) else: tmp = t_2 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))) t_1 = exp(Float64(-l)) t_2 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (M <= -28.5) tmp = t_2; elseif (M <= 1.5e-304) tmp = t_0; elseif (M <= 3.5e-227) tmp = Float64(Float64(Float64(0.5 * K) * Float64(n * sin(M))) * t_1); elseif (M <= 2.4e-68) tmp = t_0; elseif (M <= 27.0) tmp = Float64(0.5 * Float64(K * Float64(m * Float64(sin(M) * t_1)))); else tmp = t_2; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp((-0.25 * (m ^ 2.0))); t_1 = exp(-l); t_2 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (M <= -28.5) tmp = t_2; elseif (M <= 1.5e-304) tmp = t_0; elseif (M <= 3.5e-227) tmp = ((0.5 * K) * (n * sin(M))) * t_1; elseif (M <= 2.4e-68) tmp = t_0; elseif (M <= 27.0) tmp = 0.5 * (K * (m * (sin(M) * t_1))); else tmp = t_2; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[Exp[(-l)], $MachinePrecision]}, Block[{t$95$2 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -28.5], t$95$2, If[LessEqual[M, 1.5e-304], t$95$0, If[LessEqual[M, 3.5e-227], N[(N[(N[(0.5 * K), $MachinePrecision] * N[(n * N[Sin[M], $MachinePrecision]), $MachinePrecision]), $MachinePrecision] * t$95$1), $MachinePrecision], If[LessEqual[M, 2.4e-68], t$95$0, If[LessEqual[M, 27.0], N[(0.5 * N[(K * N[(m * N[(N[Sin[M], $MachinePrecision] * t$95$1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision], t$95$2]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
t_1 := e^{-\ell}\\
t_2 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;M \leq -28.5:\\
\;\;\;\;t\_2\\
\mathbf{elif}\;M \leq 1.5 \cdot 10^{-304}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 3.5 \cdot 10^{-227}:\\
\;\;\;\;\left(\left(0.5 \cdot K\right) \cdot \left(n \cdot \sin M\right)\right) \cdot t\_1\\
\mathbf{elif}\;M \leq 2.4 \cdot 10^{-68}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 27:\\
\;\;\;\;0.5 \cdot \left(K \cdot \left(m \cdot \left(\sin M \cdot t\_1\right)\right)\right)\\
\mathbf{else}:\\
\;\;\;\;t\_2\\
\end{array}
\end{array}
if M < -28.5 or 27 < M Initial program 73.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 99.3%
mul-1-neg99.3%
Simplified99.3%
if -28.5 < M < 1.5000000000000001e-304 or 3.5000000000000001e-227 < M < 2.39999999999999991e-68Initial program 71.5%
Taylor expanded in K around 0 95.2%
cos-neg95.2%
Simplified95.2%
Taylor expanded in m around inf 71.8%
if 1.5000000000000001e-304 < M < 3.5000000000000001e-227Initial program 87.5%
Taylor expanded in K around 0 87.5%
cos-neg87.5%
*-commutative87.5%
associate-*l*87.5%
metadata-eval87.5%
distribute-rgt-neg-in87.5%
*-commutative87.5%
associate-*r*87.5%
distribute-lft-neg-in87.5%
sin-neg87.5%
distribute-rgt-neg-out87.5%
remove-double-neg87.5%
Simplified87.5%
Taylor expanded in l around inf 45.2%
mul-1-neg45.2%
Simplified45.2%
Taylor expanded in n around inf 70.4%
associate-*r*70.4%
Simplified70.4%
if 2.39999999999999991e-68 < M < 27Initial program 87.5%
Taylor expanded in K around 0 87.5%
cos-neg87.5%
*-commutative87.5%
associate-*l*87.5%
metadata-eval87.5%
distribute-rgt-neg-in87.5%
*-commutative87.5%
associate-*r*87.5%
distribute-lft-neg-in87.5%
sin-neg87.5%
distribute-rgt-neg-out87.5%
remove-double-neg87.5%
Simplified87.5%
Taylor expanded in l around inf 57.3%
mul-1-neg57.3%
Simplified57.3%
Taylor expanded in m around inf 57.5%
Final simplification85.0%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- M (* n 0.5))))
(if (<= m -29.5)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(* (cos M) (exp (+ (* (- m t_0) t_0) (- (fabs (- n m)) l)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = M - (n * 0.5);
double tmp;
if (m <= -29.5) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp((((m - t_0) * t_0) + (fabs((n - 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 = m_1 - (n * 0.5d0)
if (m <= (-29.5d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp((((m - t_0) * t_0) + (abs((n - 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 = M - (n * 0.5);
double tmp;
if (m <= -29.5) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp((((m - t_0) * t_0) + (Math.abs((n - m)) - l)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = M - (n * 0.5) tmp = 0 if m <= -29.5: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp((((m - t_0) * t_0) + (math.fabs((n - m)) - l))) return tmp
function code(K, m, n, M, l) t_0 = Float64(M - Float64(n * 0.5)) tmp = 0.0 if (m <= -29.5) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(Float64(m - t_0) * t_0) + Float64(abs(Float64(n - m)) - l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = M - (n * 0.5); tmp = 0.0; if (m <= -29.5) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp((((m - t_0) * t_0) + (abs((n - m)) - l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -29.5], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(m - t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] + N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := M - n \cdot 0.5\\
\mathbf{if}\;m \leq -29.5:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(m - t\_0\right) \cdot t\_0 + \left(\left|n - m\right| - \ell\right)}\\
\end{array}
\end{array}
if m < -29.5Initial program 70.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 98.7%
if -29.5 < m Initial program 76.3%
Taylor expanded in m around 0 58.1%
+-commutative58.1%
unpow258.1%
distribute-rgt-out64.1%
*-commutative64.1%
*-commutative64.1%
Simplified64.1%
Taylor expanded in K around 0 79.6%
cos-neg96.6%
Simplified79.6%
Final simplification84.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- M (* m 0.5))))
(if (<= n 19.0)
(* (cos M) (exp (+ (* (- n t_0) t_0) (- (fabs (- n m)) l))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = M - (m * 0.5);
double tmp;
if (n <= 19.0) {
tmp = cos(M) * exp((((n - t_0) * t_0) + (fabs((n - m)) - l)));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
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 = m_1 - (m * 0.5d0)
if (n <= 19.0d0) then
tmp = cos(m_1) * exp((((n - t_0) * t_0) + (abs((n - m)) - l)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = M - (m * 0.5);
double tmp;
if (n <= 19.0) {
tmp = Math.cos(M) * Math.exp((((n - t_0) * t_0) + (Math.abs((n - m)) - l)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = M - (m * 0.5) tmp = 0 if n <= 19.0: tmp = math.cos(M) * math.exp((((n - t_0) * t_0) + (math.fabs((n - m)) - l))) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) t_0 = Float64(M - Float64(m * 0.5)) tmp = 0.0 if (n <= 19.0) tmp = Float64(cos(M) * exp(Float64(Float64(Float64(n - t_0) * t_0) + Float64(abs(Float64(n - m)) - l)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = M - (m * 0.5); tmp = 0.0; if (n <= 19.0) tmp = cos(M) * exp((((n - t_0) * t_0) + (abs((n - m)) - l))); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, 19.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(n - t$95$0), $MachinePrecision] * t$95$0), $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[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := M - m \cdot 0.5\\
\mathbf{if}\;n \leq 19:\\
\;\;\;\;\cos M \cdot e^{\left(n - t\_0\right) \cdot t\_0 + \left(\left|n - m\right| - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 19Initial program 75.0%
Taylor expanded in n around 0 64.1%
+-commutative64.1%
unpow264.1%
distribute-rgt-out66.3%
*-commutative66.3%
*-commutative66.3%
Simplified66.3%
Taylor expanded in K around 0 84.5%
cos-neg97.0%
Simplified84.5%
if 19 < n Initial program 73.3%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in n around inf 97.4%
Final simplification88.3%
(FPCore (K m n M l)
:precision binary64
(if (<= n 8.2e-308)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 19.0)
(* (cos M) (exp (+ (* M (- m M)) (- (fabs (- n m)) l))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 8.2e-308) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 19.0) {
tmp = cos(M) * exp(((M * (m - M)) + (fabs((n - m)) - l)));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
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 <= 8.2d-308) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (n <= 19.0d0) then
tmp = cos(m_1) * exp(((m_1 * (m - m_1)) + (abs((n - m)) - l)))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 8.2e-308) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 19.0) {
tmp = Math.cos(M) * Math.exp(((M * (m - M)) + (Math.abs((n - m)) - l)));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 8.2e-308: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 19.0: tmp = math.cos(M) * math.exp(((M * (m - M)) + (math.fabs((n - m)) - l))) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 8.2e-308) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 19.0) tmp = Float64(cos(M) * exp(Float64(Float64(M * Float64(m - M)) + Float64(abs(Float64(n - m)) - l)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 8.2e-308) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (n <= 19.0) tmp = cos(M) * exp(((M * (m - M)) + (abs((n - m)) - l))); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 8.2e-308], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 19.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(M * N[(m - M), $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[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 8.2 \cdot 10^{-308}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 19:\\
\;\;\;\;\cos M \cdot e^{M \cdot \left(m - M\right) + \left(\left|n - m\right| - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < 8.19999999999999965e-308Initial program 74.3%
Taylor expanded in K around 0 97.1%
cos-neg97.1%
Simplified97.1%
Taylor expanded in m around inf 63.3%
if 8.19999999999999965e-308 < n < 19Initial program 76.7%
Taylor expanded in m around 0 57.1%
+-commutative57.1%
unpow257.1%
distribute-rgt-out57.1%
*-commutative57.1%
*-commutative57.1%
Simplified57.1%
Taylor expanded in K around 0 68.1%
cos-neg96.7%
Simplified68.1%
Taylor expanded in n around 0 68.1%
associate--r+68.1%
associate-*r*68.1%
neg-mul-168.1%
cancel-sign-sub68.1%
Simplified68.1%
if 19 < n Initial program 73.3%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in n around inf 97.4%
Final simplification74.3%
(FPCore (K m n M l) :precision binary64 (if (<= n 19.0) (* (cos M) (exp (- (- (fabs (- n m)) l) (* (* m 0.5) (+ n (* m 0.5)))))) (* (cos M) (exp (* -0.25 (pow n 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 19.0) {
tmp = cos(M) * exp(((fabs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5)))));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
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 <= 19.0d0) then
tmp = cos(m_1) * exp(((abs((n - m)) - l) - ((m * 0.5d0) * (n + (m * 0.5d0)))))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 19.0) {
tmp = Math.cos(M) * Math.exp(((Math.abs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5)))));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 19.0: tmp = math.cos(M) * math.exp(((math.fabs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5))))) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 19.0) tmp = Float64(cos(M) * 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 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 19.0) tmp = cos(M) * exp(((abs((n - m)) - l) - ((m * 0.5) * (n + (m * 0.5))))); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 19.0], N[(N[Cos[M], $MachinePrecision] * 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]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 19:\\
\;\;\;\;\cos M \cdot 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 {n}^{2}}\\
\end{array}
\end{array}
if n < 19Initial program 75.0%
Taylor expanded in n around 0 64.1%
+-commutative64.1%
unpow264.1%
distribute-rgt-out66.3%
*-commutative66.3%
*-commutative66.3%
Simplified66.3%
Taylor expanded in K around 0 84.5%
cos-neg97.0%
Simplified84.5%
Taylor expanded in M around 0 67.2%
associate--r+67.2%
associate-*r*67.2%
*-commutative67.2%
*-commutative67.2%
Simplified67.2%
if 19 < n Initial program 73.3%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in n around inf 97.4%
Final simplification76.0%
(FPCore (K m n M l)
:precision binary64
(if (<= m -29.5)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= m -2.55e-306)
(* (cos M) (exp (- (pow M 2.0))))
(* (cos M) (exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -29.5) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (m <= -2.55e-306) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
}
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 <= (-29.5d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= (-2.55d-306)) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -29.5) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= -2.55e-306) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -29.5: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif m <= -2.55e-306: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -29.5) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (m <= -2.55e-306) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -29.5) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (m <= -2.55e-306) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -29.5], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -2.55e-306], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -29.5:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -2.55 \cdot 10^{-306}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -29.5Initial program 70.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 98.7%
if -29.5 < m < -2.54999999999999986e-306Initial program 75.5%
Taylor expanded in K around 0 92.9%
cos-neg92.9%
Simplified92.9%
Taylor expanded in M around inf 64.2%
mul-1-neg64.2%
Simplified64.2%
if -2.54999999999999986e-306 < m Initial program 76.6%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in n around inf 58.6%
(FPCore (K m n M l)
:precision binary64
(if (<= l 1.1e-242)
(* (cos M) (exp (* m (- M (* n 0.5)))))
(if (<= l 3.65)
(* (cos M) (exp (* n (- M (* m 0.5)))))
(* 0.5 (* K (* m (* (sin M) (exp (- l)))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.1e-242) {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
} else if (l <= 3.65) {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
} else {
tmp = 0.5 * (K * (m * (sin(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 <= 1.1d-242) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
else if (l <= 3.65d0) then
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
else
tmp = 0.5d0 * (k * (m * (sin(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 <= 1.1e-242) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else if (l <= 3.65) {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
} else {
tmp = 0.5 * (K * (m * (Math.sin(M) * Math.exp(-l))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 1.1e-242: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) elif l <= 3.65: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) else: tmp = 0.5 * (K * (m * (math.sin(M) * math.exp(-l)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 1.1e-242) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); elseif (l <= 3.65) tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); else tmp = Float64(0.5 * Float64(K * Float64(m * Float64(sin(M) * exp(Float64(-l)))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 1.1e-242) tmp = cos(M) * exp((m * (M - (n * 0.5)))); elseif (l <= 3.65) tmp = cos(M) * exp((n * (M - (m * 0.5)))); else tmp = 0.5 * (K * (m * (sin(M) * exp(-l)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 1.1e-242], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.65], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(0.5 * N[(K * N[(m * N[(N[Sin[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.1 \cdot 10^{-242}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{elif}\;\ell \leq 3.65:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;0.5 \cdot \left(K \cdot \left(m \cdot \left(\sin M \cdot e^{-\ell}\right)\right)\right)\\
\end{array}
\end{array}
if l < 1.10000000000000001e-242Initial program 76.7%
Taylor expanded in m around 0 55.2%
+-commutative55.2%
unpow255.2%
distribute-rgt-out59.5%
*-commutative59.5%
*-commutative59.5%
Simplified59.5%
Taylor expanded in K around 0 71.1%
cos-neg95.4%
Simplified71.1%
Taylor expanded in m around inf 41.0%
if 1.10000000000000001e-242 < l < 3.64999999999999991Initial program 69.3%
Taylor expanded in n around 0 47.1%
+-commutative47.1%
unpow247.1%
distribute-rgt-out53.3%
*-commutative53.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in K around 0 75.8%
cos-neg99.9%
Simplified75.8%
Taylor expanded in n around inf 29.2%
if 3.64999999999999991 < l Initial program 73.9%
Taylor expanded in K around 0 81.2%
cos-neg81.2%
*-commutative81.2%
associate-*l*81.2%
metadata-eval81.2%
distribute-rgt-neg-in81.2%
*-commutative81.2%
associate-*r*81.2%
distribute-lft-neg-in81.2%
sin-neg81.2%
distribute-rgt-neg-out81.2%
remove-double-neg81.2%
Simplified81.2%
Taylor expanded in l around inf 79.8%
mul-1-neg79.8%
Simplified79.8%
Taylor expanded in m around inf 98.6%
Final simplification54.2%
(FPCore (K m n M l) :precision binary64 (if (<= l 1.9e-242) (* (cos M) (exp (* m (- M (* n 0.5))))) (if (<= l 3.7) (* (cos M) (exp (* n (- M (* m 0.5))))) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.9e-242) {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
} else if (l <= 3.7) {
tmp = cos(M) * exp((n * (M - (m * 0.5))));
} 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.9d-242) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
else if (l <= 3.7d0) then
tmp = cos(m_1) * exp((n * (m_1 - (m * 0.5d0))))
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.9e-242) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else if (l <= 3.7) {
tmp = Math.cos(M) * Math.exp((n * (M - (m * 0.5))));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 1.9e-242: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) elif l <= 3.7: tmp = math.cos(M) * math.exp((n * (M - (m * 0.5)))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 1.9e-242) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); elseif (l <= 3.7) tmp = Float64(cos(M) * exp(Float64(n * Float64(M - Float64(m * 0.5))))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= 1.9e-242) tmp = cos(M) * exp((m * (M - (n * 0.5)))); elseif (l <= 3.7) tmp = cos(M) * exp((n * (M - (m * 0.5)))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 1.9e-242], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 3.7], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(n * N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.9 \cdot 10^{-242}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{elif}\;\ell \leq 3.7:\\
\;\;\;\;\cos M \cdot e^{n \cdot \left(M - m \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if l < 1.9000000000000001e-242Initial program 76.7%
Taylor expanded in m around 0 55.2%
+-commutative55.2%
unpow255.2%
distribute-rgt-out59.5%
*-commutative59.5%
*-commutative59.5%
Simplified59.5%
Taylor expanded in K around 0 71.1%
cos-neg95.4%
Simplified71.1%
Taylor expanded in m around inf 41.0%
if 1.9000000000000001e-242 < l < 3.7000000000000002Initial program 69.3%
Taylor expanded in n around 0 47.1%
+-commutative47.1%
unpow247.1%
distribute-rgt-out53.3%
*-commutative53.3%
*-commutative53.3%
Simplified53.3%
Taylor expanded in K around 0 75.8%
cos-neg99.9%
Simplified75.8%
Taylor expanded in n around inf 29.2%
if 3.7000000000000002 < l Initial program 73.9%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 98.6%
mul-1-neg79.8%
Simplified98.6%
Taylor expanded in M around 0 98.6%
Final simplification54.2%
(FPCore (K m n M l) :precision binary64 (if (<= l 1.6e-9) (* (cos M) (exp (* m (- M (* n 0.5))))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= 1.6e-9) {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
} 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 <= 1.6d-9) then
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
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 <= 1.6e-9) {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= 1.6e-9: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= 1.6e-9) tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); 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 <= 1.6e-9) tmp = cos(M) * exp((m * (M - (n * 0.5)))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, 1.6e-9], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq 1.6 \cdot 10^{-9}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < 1.60000000000000006e-9Initial program 74.9%
Taylor expanded in m around 0 52.3%
+-commutative52.3%
unpow252.3%
distribute-rgt-out57.8%
*-commutative57.8%
*-commutative57.8%
Simplified57.8%
Taylor expanded in K around 0 73.0%
cos-neg96.5%
Simplified73.0%
Taylor expanded in m around inf 40.9%
if 1.60000000000000006e-9 < l Initial program 73.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 96.0%
mul-1-neg77.9%
Simplified96.0%
Final simplification56.4%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * 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 = cos(m_1) * exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(-l);
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(-l)
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(-l))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(-l); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{-\ell}
\end{array}
Initial program 74.5%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in l around inf 33.5%
mul-1-neg28.0%
Simplified33.5%
(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 74.5%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in l around inf 33.5%
mul-1-neg28.0%
Simplified33.5%
Taylor expanded in M around 0 33.5%
(FPCore (K m n M l) :precision binary64 (cos M))
double code(double K, double m, double n, double M, double l) {
return cos(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)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M);
}
def code(K, m, n, M, l): return math.cos(M)
function code(K, m, n, M, l) return cos(M) end
function tmp = code(K, m, n, M, l) tmp = cos(M); end
code[K_, m_, n_, M_, l_] := N[Cos[M], $MachinePrecision]
\begin{array}{l}
\\
\cos M
\end{array}
Initial program 74.5%
Taylor expanded in K around 0 97.5%
cos-neg97.5%
Simplified97.5%
Taylor expanded in l around inf 33.5%
mul-1-neg28.0%
Simplified33.5%
Taylor expanded in l around 0 5.8%
(FPCore (K m n M l) :precision binary64 (+ 1.0 (* 0.5 (* (+ m n) (* M K)))))
double code(double K, double m, double n, double M, double l) {
return 1.0 + (0.5 * ((m + n) * (M * K)));
}
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 = 1.0d0 + (0.5d0 * ((m + n) * (m_1 * k)))
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0 + (0.5 * ((m + n) * (M * K)));
}
def code(K, m, n, M, l): return 1.0 + (0.5 * ((m + n) * (M * K)))
function code(K, m, n, M, l) return Float64(1.0 + Float64(0.5 * Float64(Float64(m + n) * Float64(M * K)))) end
function tmp = code(K, m, n, M, l) tmp = 1.0 + (0.5 * ((m + n) * (M * K))); end
code[K_, m_, n_, M_, l_] := N[(1.0 + N[(0.5 * N[(N[(m + n), $MachinePrecision] * N[(M * K), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.5 \cdot \left(\left(m + n\right) \cdot \left(M \cdot K\right)\right)
\end{array}
Initial program 74.5%
*-un-lft-identity74.5%
*-commutative74.5%
Applied egg-rr13.6%
Taylor expanded in M around inf 4.6%
Taylor expanded in M around 0 4.9%
*-commutative4.9%
*-commutative4.9%
Simplified4.9%
Taylor expanded in K around 0 5.0%
associate-*r*5.4%
Simplified5.4%
Final simplification5.4%
(FPCore (K m n M l) :precision binary64 (+ 1.0 (* 0.5 (* K (* M (+ m n))))))
double code(double K, double m, double n, double M, double l) {
return 1.0 + (0.5 * (K * (M * (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 = 1.0d0 + (0.5d0 * (k * (m_1 * (m + n))))
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0 + (0.5 * (K * (M * (m + n))));
}
def code(K, m, n, M, l): return 1.0 + (0.5 * (K * (M * (m + n))))
function code(K, m, n, M, l) return Float64(1.0 + Float64(0.5 * Float64(K * Float64(M * Float64(m + n))))) end
function tmp = code(K, m, n, M, l) tmp = 1.0 + (0.5 * (K * (M * (m + n)))); end
code[K_, m_, n_, M_, l_] := N[(1.0 + N[(0.5 * N[(K * N[(M * N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
1 + 0.5 \cdot \left(K \cdot \left(M \cdot \left(m + n\right)\right)\right)
\end{array}
Initial program 74.5%
*-un-lft-identity74.5%
*-commutative74.5%
Applied egg-rr13.6%
Taylor expanded in M around inf 4.6%
Taylor expanded in M around 0 4.9%
*-commutative4.9%
*-commutative4.9%
Simplified4.9%
Taylor expanded in K around 0 5.0%
herbie shell --seed 2024088
(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)))))))