
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
Sampling outcomes in binary64 precision:
Herbie found 12 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (fabs (- m n)) 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((m - n)) - 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((m - n)) - 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((m - n)) - 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((m - n)) - 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(m - n)) - 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((m - n)) - 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[(m - n), $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|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 77.6%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Final simplification96.7%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (+ m n) 0.5)))
(if (<= n -9.2e-129)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 950000.0)
(*
(cos (- (/ (* (+ m n) K) 2.0) M))
(exp (+ (* (- t_0 M) (- M t_0)) (- (fabs (- m n)) l))))
(exp (* -0.25 (pow n 2.0)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (m + n) * 0.5;
double tmp;
if (n <= -9.2e-129) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 950000.0) {
tmp = cos(((((m + n) * K) / 2.0) - M)) * exp((((t_0 - M) * (M - t_0)) + (fabs((m - n)) - l)));
} else {
tmp = 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 + n) * 0.5d0
if (n <= (-9.2d-129)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (n <= 950000.0d0) then
tmp = cos(((((m + n) * k) / 2.0d0) - m_1)) * exp((((t_0 - m_1) * (m_1 - t_0)) + (abs((m - n)) - l)))
else
tmp = 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 + n) * 0.5;
double tmp;
if (n <= -9.2e-129) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 950000.0) {
tmp = Math.cos(((((m + n) * K) / 2.0) - M)) * Math.exp((((t_0 - M) * (M - t_0)) + (Math.abs((m - n)) - l)));
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (m + n) * 0.5 tmp = 0 if n <= -9.2e-129: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 950000.0: tmp = math.cos(((((m + n) * K) / 2.0) - M)) * math.exp((((t_0 - M) * (M - t_0)) + (math.fabs((m - n)) - l))) else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(m + n) * 0.5) tmp = 0.0 if (n <= -9.2e-129) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 950000.0) tmp = Float64(cos(Float64(Float64(Float64(Float64(m + n) * K) / 2.0) - M)) * exp(Float64(Float64(Float64(t_0 - M) * Float64(M - t_0)) + Float64(abs(Float64(m - n)) - l)))); else tmp = exp(Float64(-0.25 * (n ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = (m + n) * 0.5; tmp = 0.0; if (n <= -9.2e-129) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (n <= 950000.0) tmp = cos(((((m + n) * K) / 2.0) - M)) * exp((((t_0 - M) * (M - t_0)) + (abs((m - n)) - l))); else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision]}, If[LessEqual[n, -9.2e-129], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 950000.0], N[(N[Cos[N[(N[(N[(N[(m + n), $MachinePrecision] * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $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]), $MachinePrecision], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \left(m + n\right) \cdot 0.5\\
\mathbf{if}\;n \leq -9.2 \cdot 10^{-129}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 950000:\\
\;\;\;\;\cos \left(\frac{\left(m + n\right) \cdot K}{2} - M\right) \cdot e^{\left(t\_0 - M\right) \cdot \left(M - t\_0\right) + \left(\left|m - n\right| - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < -9.1999999999999998e-129Initial program 70.4%
Taylor expanded in K around 0 95.5%
cos-neg95.5%
Simplified95.5%
Taylor expanded in m around inf 54.1%
if -9.1999999999999998e-129 < n < 9.5e5Initial program 89.3%
unpow289.3%
div-inv89.3%
metadata-eval89.3%
div-inv89.3%
metadata-eval89.3%
Applied egg-rr89.3%
if 9.5e5 < n Initial program 66.7%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in n around inf 98.4%
Taylor expanded in M around 0 98.4%
Final simplification80.1%
(FPCore (K m n M l)
:precision binary64
(if (<= n -9.2e-129)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 920000.0)
(*
(cos (- (/ (* (+ m n) K) 2.0) M))
(exp (+ (* (+ n (- (* m 0.5) M)) (- M (* m 0.5))) (- (fabs (- m n)) l))))
(exp (* -0.25 (pow n 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -9.2e-129) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 920000.0) {
tmp = cos(((((m + n) * K) / 2.0) - M)) * exp((((n + ((m * 0.5) - M)) * (M - (m * 0.5))) + (fabs((m - n)) - l)));
} else {
tmp = 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 <= (-9.2d-129)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (n <= 920000.0d0) then
tmp = cos(((((m + n) * k) / 2.0d0) - m_1)) * exp((((n + ((m * 0.5d0) - m_1)) * (m_1 - (m * 0.5d0))) + (abs((m - n)) - l)))
else
tmp = 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 <= -9.2e-129) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 920000.0) {
tmp = Math.cos(((((m + n) * K) / 2.0) - M)) * Math.exp((((n + ((m * 0.5) - M)) * (M - (m * 0.5))) + (Math.abs((m - n)) - l)));
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -9.2e-129: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 920000.0: tmp = math.cos(((((m + n) * K) / 2.0) - M)) * math.exp((((n + ((m * 0.5) - M)) * (M - (m * 0.5))) + (math.fabs((m - n)) - l))) else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -9.2e-129) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 920000.0) tmp = Float64(cos(Float64(Float64(Float64(Float64(m + n) * K) / 2.0) - M)) * exp(Float64(Float64(Float64(n + Float64(Float64(m * 0.5) - M)) * Float64(M - Float64(m * 0.5))) + Float64(abs(Float64(m - n)) - l)))); else tmp = 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 <= -9.2e-129) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (n <= 920000.0) tmp = cos(((((m + n) * K) / 2.0) - M)) * exp((((n + ((m * 0.5) - M)) * (M - (m * 0.5))) + (abs((m - n)) - l))); else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -9.2e-129], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 920000.0], N[(N[Cos[N[(N[(N[(N[(m + n), $MachinePrecision] * K), $MachinePrecision] / 2.0), $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[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -9.2 \cdot 10^{-129}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 920000:\\
\;\;\;\;\cos \left(\frac{\left(m + n\right) \cdot K}{2} - M\right) \cdot e^{\left(n + \left(m \cdot 0.5 - M\right)\right) \cdot \left(M - m \cdot 0.5\right) + \left(\left|m - n\right| - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < -9.1999999999999998e-129Initial program 70.4%
Taylor expanded in K around 0 95.5%
cos-neg95.5%
Simplified95.5%
Taylor expanded in m around inf 54.1%
if -9.1999999999999998e-129 < n < 9.2e5Initial program 89.3%
Taylor expanded in n around 0 89.3%
+-commutative89.3%
unpow289.3%
distribute-rgt-out89.3%
*-commutative89.3%
*-commutative89.3%
Simplified89.3%
if 9.2e5 < n Initial program 66.7%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in n around inf 98.4%
Taylor expanded in M around 0 98.4%
Final simplification80.1%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0
(*
(cos (- (* K (/ m 2.0)) M))
(exp (+ (- m n) (- (* (pow n 2.0) 0.25) l))))))
(if (<= n -1.02e-200)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 4.4e-172)
t_0
(if (<= n 1.15e-7)
(* (cos M) (exp (- (pow M 2.0))))
(if (<= n 750000.0) t_0 (exp (* -0.25 (pow n 2.0)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(((K * (m / 2.0)) - M)) * exp(((m - n) + ((pow(n, 2.0) * 0.25) - l)));
double tmp;
if (n <= -1.02e-200) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 4.4e-172) {
tmp = t_0;
} else if (n <= 1.15e-7) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else if (n <= 750000.0) {
tmp = t_0;
} else {
tmp = 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 = cos(((k * (m / 2.0d0)) - m_1)) * exp(((m - n) + (((n ** 2.0d0) * 0.25d0) - l)))
if (n <= (-1.02d-200)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (n <= 4.4d-172) then
tmp = t_0
else if (n <= 1.15d-7) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else if (n <= 750000.0d0) then
tmp = t_0
else
tmp = 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 = Math.cos(((K * (m / 2.0)) - M)) * Math.exp(((m - n) + ((Math.pow(n, 2.0) * 0.25) - l)));
double tmp;
if (n <= -1.02e-200) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 4.4e-172) {
tmp = t_0;
} else if (n <= 1.15e-7) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else if (n <= 750000.0) {
tmp = t_0;
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(((K * (m / 2.0)) - M)) * math.exp(((m - n) + ((math.pow(n, 2.0) * 0.25) - l))) tmp = 0 if n <= -1.02e-200: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 4.4e-172: tmp = t_0 elif n <= 1.15e-7: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) elif n <= 750000.0: tmp = t_0 else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(Float64(Float64(K * Float64(m / 2.0)) - M)) * exp(Float64(Float64(m - n) + Float64(Float64((n ^ 2.0) * 0.25) - l)))) tmp = 0.0 if (n <= -1.02e-200) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 4.4e-172) tmp = t_0; elseif (n <= 1.15e-7) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); elseif (n <= 750000.0) tmp = t_0; else tmp = exp(Float64(-0.25 * (n ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(((K * (m / 2.0)) - M)) * exp(((m - n) + (((n ^ 2.0) * 0.25) - l))); tmp = 0.0; if (n <= -1.02e-200) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (n <= 4.4e-172) tmp = t_0; elseif (n <= 1.15e-7) tmp = cos(M) * exp(-(M ^ 2.0)); elseif (n <= 750000.0) tmp = t_0; else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[N[(N[(K * N[(m / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - n), $MachinePrecision] + N[(N[(N[Power[n, 2.0], $MachinePrecision] * 0.25), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[n, -1.02e-200], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 4.4e-172], t$95$0, If[LessEqual[n, 1.15e-7], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 750000.0], t$95$0, N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(K \cdot \frac{m}{2} - M\right) \cdot e^{\left(m - n\right) + \left({n}^{2} \cdot 0.25 - \ell\right)}\\
\mathbf{if}\;n \leq -1.02 \cdot 10^{-200}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 4.4 \cdot 10^{-172}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.15 \cdot 10^{-7}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{elif}\;n \leq 750000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < -1.02e-200Initial program 73.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in m around inf 52.8%
if -1.02e-200 < n < 4.40000000000000018e-172 or 1.14999999999999997e-7 < n < 7.5e5Initial program 88.8%
Taylor expanded in m around inf 89.1%
Taylor expanded in n around inf 41.1%
*-commutative41.1%
Simplified41.1%
pow141.1%
Applied egg-rr59.3%
unpow159.3%
associate--r-59.3%
*-commutative59.3%
Simplified59.3%
if 4.40000000000000018e-172 < n < 1.14999999999999997e-7Initial program 88.5%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in M around inf 62.7%
mul-1-neg62.7%
Simplified62.7%
if 7.5e5 < n Initial program 66.7%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in n around inf 98.4%
Taylor expanded in M around 0 98.4%
Final simplification66.8%
(FPCore (K m n M l)
:precision binary64
(if (<= n -2.35e-201)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 750000.0)
(*
(cos (- (* 0.5 (* n K)) M))
(exp (- (fabs (- m n)) (+ l (* M (- M n))))))
(exp (* -0.25 (pow n 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= -2.35e-201) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 750000.0) {
tmp = cos(((0.5 * (n * K)) - M)) * exp((fabs((m - n)) - (l + (M * (M - n)))));
} else {
tmp = 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 <= (-2.35d-201)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (n <= 750000.0d0) then
tmp = cos(((0.5d0 * (n * k)) - m_1)) * exp((abs((m - n)) - (l + (m_1 * (m_1 - n)))))
else
tmp = 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 <= -2.35e-201) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 750000.0) {
tmp = Math.cos(((0.5 * (n * K)) - M)) * Math.exp((Math.abs((m - n)) - (l + (M * (M - n)))));
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= -2.35e-201: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 750000.0: tmp = math.cos(((0.5 * (n * K)) - M)) * math.exp((math.fabs((m - n)) - (l + (M * (M - n))))) else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= -2.35e-201) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 750000.0) tmp = Float64(cos(Float64(Float64(0.5 * Float64(n * K)) - M)) * exp(Float64(abs(Float64(m - n)) - Float64(l + Float64(M * Float64(M - n)))))); else tmp = 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 <= -2.35e-201) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (n <= 750000.0) tmp = cos(((0.5 * (n * K)) - M)) * exp((abs((m - n)) - (l + (M * (M - n))))); else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, -2.35e-201], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 750000.0], N[(N[Cos[N[(N[(0.5 * N[(n * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[(M * N[(M - n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -2.35 \cdot 10^{-201}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 750000:\\
\;\;\;\;\cos \left(0.5 \cdot \left(n \cdot K\right) - M\right) \cdot e^{\left|m - n\right| - \left(\ell + M \cdot \left(M - n\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < -2.34999999999999997e-201Initial program 73.9%
Taylor expanded in K around 0 96.2%
cos-neg96.2%
Simplified96.2%
Taylor expanded in m around inf 52.8%
if -2.34999999999999997e-201 < n < 7.5e5Initial program 88.7%
Taylor expanded in n around 0 88.7%
+-commutative88.7%
unpow288.7%
distribute-rgt-out88.7%
*-commutative88.7%
*-commutative88.7%
Simplified88.7%
Taylor expanded in m around 0 71.2%
associate-*r*71.2%
neg-mul-171.2%
Simplified71.2%
if 7.5e5 < n Initial program 66.7%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in n around inf 98.4%
Taylor expanded in M around 0 98.4%
Final simplification70.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= n -1.5e-247)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= n 7.8e-237)
t_0
(if (<= n 3.7e-172)
(* (cos M) (exp (- l)))
(if (<= n 750000.0) t_0 (exp (* -0.25 (pow n 2.0)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (n <= -1.5e-247) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (n <= 7.8e-237) {
tmp = t_0;
} else if (n <= 3.7e-172) {
tmp = cos(M) * exp(-l);
} else if (n <= 750000.0) {
tmp = t_0;
} else {
tmp = 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 = cos(m_1) * exp(-(m_1 ** 2.0d0))
if (n <= (-1.5d-247)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (n <= 7.8d-237) then
tmp = t_0
else if (n <= 3.7d-172) then
tmp = cos(m_1) * exp(-l)
else if (n <= 750000.0d0) then
tmp = t_0
else
tmp = 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 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double tmp;
if (n <= -1.5e-247) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (n <= 7.8e-237) {
tmp = t_0;
} else if (n <= 3.7e-172) {
tmp = Math.cos(M) * Math.exp(-l);
} else if (n <= 750000.0) {
tmp = t_0;
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if n <= -1.5e-247: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif n <= 7.8e-237: tmp = t_0 elif n <= 3.7e-172: tmp = math.cos(M) * math.exp(-l) elif n <= 750000.0: tmp = t_0 else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (n <= -1.5e-247) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (n <= 7.8e-237) tmp = t_0; elseif (n <= 3.7e-172) tmp = Float64(cos(M) * exp(Float64(-l))); elseif (n <= 750000.0) tmp = t_0; else tmp = exp(Float64(-0.25 * (n ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (n <= -1.5e-247) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (n <= 7.8e-237) tmp = t_0; elseif (n <= 3.7e-172) tmp = cos(M) * exp(-l); elseif (n <= 750000.0) tmp = t_0; else tmp = exp((-0.25 * (n ^ 2.0))); 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]}, If[LessEqual[n, -1.5e-247], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 7.8e-237], t$95$0, If[LessEqual[n, 3.7e-172], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 750000.0], t$95$0, N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;n \leq -1.5 \cdot 10^{-247}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;n \leq 7.8 \cdot 10^{-237}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 3.7 \cdot 10^{-172}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{elif}\;n \leq 750000:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if n < -1.4999999999999999e-247Initial program 76.3%
Taylor expanded in K around 0 96.6%
cos-neg96.6%
Simplified96.6%
Taylor expanded in m around inf 53.6%
if -1.4999999999999999e-247 < n < 7.7999999999999997e-237 or 3.70000000000000001e-172 < n < 7.5e5Initial program 87.0%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in M around inf 61.1%
mul-1-neg61.1%
Simplified61.1%
if 7.7999999999999997e-237 < n < 3.70000000000000001e-172Initial program 88.9%
Taylor expanded in K around 0 94.4%
cos-neg94.4%
Simplified94.4%
Taylor expanded in l around inf 67.4%
mul-1-neg67.4%
Simplified67.4%
if 7.5e5 < n Initial program 66.7%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in n around inf 98.4%
Taylor expanded in M around 0 98.4%
Final simplification67.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= M -31000000.0)
t_0
(if (<= M 2.3e-184)
(exp (* -0.25 (pow n 2.0)))
(if (<= M 0.0205)
(* (cos (- (/ (* m K) 2.0) M)) (exp (* -0.25 (* m m))))
t_0)))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (M <= -31000000.0) {
tmp = t_0;
} else if (M <= 2.3e-184) {
tmp = exp((-0.25 * pow(n, 2.0)));
} else if (M <= 0.0205) {
tmp = cos((((m * K) / 2.0) - M)) * exp((-0.25 * (m * m)));
} else {
tmp = t_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 = cos(m_1) * exp(-(m_1 ** 2.0d0))
if (m_1 <= (-31000000.0d0)) then
tmp = t_0
else if (m_1 <= 2.3d-184) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
else if (m_1 <= 0.0205d0) then
tmp = cos((((m * k) / 2.0d0) - m_1)) * exp(((-0.25d0) * (m * m)))
else
tmp = t_0
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 tmp;
if (M <= -31000000.0) {
tmp = t_0;
} else if (M <= 2.3e-184) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else if (M <= 0.0205) {
tmp = Math.cos((((m * K) / 2.0) - M)) * Math.exp((-0.25 * (m * m)));
} else {
tmp = t_0;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if M <= -31000000.0: tmp = t_0 elif M <= 2.3e-184: tmp = math.exp((-0.25 * math.pow(n, 2.0))) elif M <= 0.0205: tmp = math.cos((((m * K) / 2.0) - M)) * math.exp((-0.25 * (m * m))) else: tmp = t_0 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (M <= -31000000.0) tmp = t_0; elseif (M <= 2.3e-184) tmp = exp(Float64(-0.25 * (n ^ 2.0))); elseif (M <= 0.0205) tmp = Float64(cos(Float64(Float64(Float64(m * K) / 2.0) - M)) * exp(Float64(-0.25 * Float64(m * m)))); else tmp = t_0; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (M <= -31000000.0) tmp = t_0; elseif (M <= 2.3e-184) tmp = exp((-0.25 * (n ^ 2.0))); elseif (M <= 0.0205) tmp = cos((((m * K) / 2.0) - M)) * exp((-0.25 * (m * m))); else tmp = t_0; 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]}, If[LessEqual[M, -31000000.0], t$95$0, If[LessEqual[M, 2.3e-184], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], If[LessEqual[M, 0.0205], N[(N[Cos[N[(N[(N[(m * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], t$95$0]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;M \leq -31000000:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 2.3 \cdot 10^{-184}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{elif}\;M \leq 0.0205:\\
\;\;\;\;\cos \left(\frac{m \cdot K}{2} - M\right) \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{else}:\\
\;\;\;\;t\_0\\
\end{array}
\end{array}
if M < -3.1e7 or 0.0205000000000000009 < M Initial program 79.4%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 97.1%
mul-1-neg97.1%
Simplified97.1%
if -3.1e7 < M < 2.2999999999999999e-184Initial program 68.8%
Taylor expanded in K around 0 92.4%
cos-neg92.4%
Simplified92.4%
Taylor expanded in n around inf 63.9%
Taylor expanded in M around 0 63.9%
if 2.2999999999999999e-184 < M < 0.0205000000000000009Initial program 92.0%
Taylor expanded in m around inf 94.3%
Taylor expanded in m around inf 52.8%
unpow252.8%
Applied egg-rr52.8%
Final simplification80.0%
(FPCore (K m n M l)
:precision binary64
(if (<= l -2.7e+23)
(* (cos (- (* K (/ m 2.0)) M)) (exp l))
(if (<= l -6e-308)
(* (cos (- (/ (* m K) 2.0) M)) (exp (* -0.25 (* m m))))
(if (<= l 8.5e-12) (exp (* -0.25 (pow n 2.0))) (* (cos M) (exp (- l)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -2.7e+23) {
tmp = cos(((K * (m / 2.0)) - M)) * exp(l);
} else if (l <= -6e-308) {
tmp = cos((((m * K) / 2.0) - M)) * exp((-0.25 * (m * m)));
} else if (l <= 8.5e-12) {
tmp = exp((-0.25 * pow(n, 2.0)));
} 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 <= (-2.7d+23)) then
tmp = cos(((k * (m / 2.0d0)) - m_1)) * exp(l)
else if (l <= (-6d-308)) then
tmp = cos((((m * k) / 2.0d0) - m_1)) * exp(((-0.25d0) * (m * m)))
else if (l <= 8.5d-12) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
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 <= -2.7e+23) {
tmp = Math.cos(((K * (m / 2.0)) - M)) * Math.exp(l);
} else if (l <= -6e-308) {
tmp = Math.cos((((m * K) / 2.0) - M)) * Math.exp((-0.25 * (m * m)));
} else if (l <= 8.5e-12) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -2.7e+23: tmp = math.cos(((K * (m / 2.0)) - M)) * math.exp(l) elif l <= -6e-308: tmp = math.cos((((m * K) / 2.0) - M)) * math.exp((-0.25 * (m * m))) elif l <= 8.5e-12: tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -2.7e+23) tmp = Float64(cos(Float64(Float64(K * Float64(m / 2.0)) - M)) * exp(l)); elseif (l <= -6e-308) tmp = Float64(cos(Float64(Float64(Float64(m * K) / 2.0) - M)) * exp(Float64(-0.25 * Float64(m * m)))); elseif (l <= 8.5e-12) tmp = exp(Float64(-0.25 * (n ^ 2.0))); 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 <= -2.7e+23) tmp = cos(((K * (m / 2.0)) - M)) * exp(l); elseif (l <= -6e-308) tmp = cos((((m * K) / 2.0) - M)) * exp((-0.25 * (m * m))); elseif (l <= 8.5e-12) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -2.7e+23], N[(N[Cos[N[(N[(K * N[(m / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, -6e-308], N[(N[Cos[N[(N[(N[(m * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(-0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e-12], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -2.7 \cdot 10^{+23}:\\
\;\;\;\;\cos \left(K \cdot \frac{m}{2} - M\right) \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq -6 \cdot 10^{-308}:\\
\;\;\;\;\cos \left(\frac{m \cdot K}{2} - M\right) \cdot e^{-0.25 \cdot \left(m \cdot m\right)}\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-12}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -2.6999999999999999e23Initial program 73.1%
Taylor expanded in m around inf 82.1%
Taylor expanded in l around inf 20.4%
mul-1-neg19.1%
Simplified20.4%
pow120.4%
associate-/l*20.4%
add-sqr-sqrt20.4%
sqrt-unprod20.4%
sqr-neg20.4%
sqrt-unprod0.0%
add-sqr-sqrt63.0%
Applied egg-rr63.0%
unpow163.0%
Simplified63.0%
if -2.6999999999999999e23 < l < -6.00000000000000044e-308Initial program 86.7%
Taylor expanded in m around inf 90.1%
Taylor expanded in m around inf 54.5%
unpow254.5%
Applied egg-rr54.5%
if -6.00000000000000044e-308 < l < 8.4999999999999997e-12Initial program 66.3%
Taylor expanded in K around 0 94.2%
cos-neg94.2%
Simplified94.2%
Taylor expanded in n around inf 55.9%
Taylor expanded in M around 0 55.9%
if 8.4999999999999997e-12 < l Initial program 84.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification67.6%
(FPCore (K m n M l) :precision binary64 (if (or (<= n -1.65e-88) (not (<= n 750000.0))) (exp (* -0.25 (pow n 2.0))) (* (cos M) (exp (- l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -1.65e-88) || !(n <= 750000.0)) {
tmp = exp((-0.25 * pow(n, 2.0)));
} 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 ((n <= (-1.65d-88)) .or. (.not. (n <= 750000.0d0))) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
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 ((n <= -1.65e-88) || !(n <= 750000.0)) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -1.65e-88) or not (n <= 750000.0): tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -1.65e-88) || !(n <= 750000.0)) tmp = exp(Float64(-0.25 * (n ^ 2.0))); 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 ((n <= -1.65e-88) || ~((n <= 750000.0))) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -1.65e-88], N[Not[LessEqual[n, 750000.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -1.65 \cdot 10^{-88} \lor \neg \left(n \leq 750000\right):\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if n < -1.64999999999999997e-88 or 7.5e5 < n Initial program 68.7%
Taylor expanded in K around 0 97.3%
cos-neg97.3%
Simplified97.3%
Taylor expanded in n around inf 90.7%
Taylor expanded in M around 0 90.7%
if -1.64999999999999997e-88 < n < 7.5e5Initial program 88.3%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in l around inf 44.1%
mul-1-neg44.1%
Simplified44.1%
Final simplification69.4%
(FPCore (K m n M l) :precision binary64 (if (<= l -0.012) (* (cos (- (* K (/ m 2.0)) M)) (exp l)) (if (<= l 8.5e-12) (exp (* -0.25 (pow n 2.0))) (* (cos M) (exp (- l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -0.012) {
tmp = cos(((K * (m / 2.0)) - M)) * exp(l);
} else if (l <= 8.5e-12) {
tmp = exp((-0.25 * pow(n, 2.0)));
} 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 <= (-0.012d0)) then
tmp = cos(((k * (m / 2.0d0)) - m_1)) * exp(l)
else if (l <= 8.5d-12) then
tmp = exp(((-0.25d0) * (n ** 2.0d0)))
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 <= -0.012) {
tmp = Math.cos(((K * (m / 2.0)) - M)) * Math.exp(l);
} else if (l <= 8.5e-12) {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -0.012: tmp = math.cos(((K * (m / 2.0)) - M)) * math.exp(l) elif l <= 8.5e-12: tmp = math.exp((-0.25 * math.pow(n, 2.0))) else: tmp = math.cos(M) * math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -0.012) tmp = Float64(cos(Float64(Float64(K * Float64(m / 2.0)) - M)) * exp(l)); elseif (l <= 8.5e-12) tmp = exp(Float64(-0.25 * (n ^ 2.0))); 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 <= -0.012) tmp = cos(((K * (m / 2.0)) - M)) * exp(l); elseif (l <= 8.5e-12) tmp = exp((-0.25 * (n ^ 2.0))); else tmp = cos(M) * exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -0.012], N[(N[Cos[N[(N[(K * N[(m / 2.0), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[l, 8.5e-12], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -0.012:\\
\;\;\;\;\cos \left(K \cdot \frac{m}{2} - M\right) \cdot e^{\ell}\\
\mathbf{elif}\;\ell \leq 8.5 \cdot 10^{-12}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\end{array}
\end{array}
if l < -0.012Initial program 75.7%
Taylor expanded in m around inf 83.8%
Taylor expanded in l around inf 18.6%
mul-1-neg17.5%
Simplified18.6%
pow118.6%
associate-/l*18.6%
add-sqr-sqrt18.6%
sqrt-unprod18.6%
sqr-neg18.6%
sqrt-unprod0.0%
add-sqr-sqrt65.2%
Applied egg-rr65.2%
unpow165.2%
Simplified65.2%
if -0.012 < l < 8.4999999999999997e-12Initial program 75.4%
Taylor expanded in K around 0 95.5%
cos-neg95.5%
Simplified95.5%
Taylor expanded in n around inf 58.0%
Taylor expanded in M around 0 58.0%
if 8.4999999999999997e-12 < l Initial program 84.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in l around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification69.8%
(FPCore (K m n M l) :precision binary64 (exp (* -0.25 (pow n 2.0))))
double code(double K, double m, double n, double M, double l) {
return exp((-0.25 * pow(n, 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 = exp(((-0.25d0) * (n ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((-0.25 * Math.pow(n, 2.0)));
}
def code(K, m, n, M, l): return math.exp((-0.25 * math.pow(n, 2.0)))
function code(K, m, n, M, l) return exp(Float64(-0.25 * (n ^ 2.0))) end
function tmp = code(K, m, n, M, l) tmp = exp((-0.25 * (n ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{-0.25 \cdot {n}^{2}}
\end{array}
Initial program 77.6%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in n around inf 53.6%
Taylor expanded in M around 0 53.5%
Final simplification53.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 77.6%
Taylor expanded in K around 0 96.7%
cos-neg96.7%
Simplified96.7%
Taylor expanded in n around inf 53.6%
Taylor expanded in n around 0 7.4%
Final simplification7.4%
herbie shell --seed 2024053
(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)))))))