
(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 14 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (cbrt (- (- (fabs (- n m)) l) (pow (- (* (+ m n) 0.5) M) 2.0))))) (* (cos M) (pow (exp (pow t_0 2.0)) t_0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cbrt(((fabs((n - m)) - l) - pow((((m + n) * 0.5) - M), 2.0)));
return cos(M) * pow(exp(pow(t_0, 2.0)), t_0);
}
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.cbrt(((Math.abs((n - m)) - l) - Math.pow((((m + n) * 0.5) - M), 2.0)));
return Math.cos(M) * Math.pow(Math.exp(Math.pow(t_0, 2.0)), t_0);
}
function code(K, m, n, M, l) t_0 = cbrt(Float64(Float64(abs(Float64(n - m)) - l) - (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0))) return Float64(cos(M) * (exp((t_0 ^ 2.0)) ^ t_0)) end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Power[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Cos[M], $MachinePrecision] * N[Power[N[Exp[N[Power[t$95$0, 2.0], $MachinePrecision]], $MachinePrecision], t$95$0], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\left(\left|n - m\right| - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}\\
\cos M \cdot {\left(e^{{t\_0}^{2}}\right)}^{t\_0}
\end{array}
\end{array}
Initial program 77.2%
associate-/l*77.6%
+-commutative77.6%
associate-/l*77.2%
associate-/l*77.6%
+-commutative77.6%
exp-diff29.9%
sub-neg29.9%
exp-sum24.4%
associate-/r*24.4%
exp-diff29.9%
Simplified77.6%
Taylor expanded in K around 0 95.4%
cos-neg95.4%
Simplified95.4%
add-sqr-sqrt95.4%
sqrt-unprod94.6%
pow-prod-up94.6%
div-inv94.6%
fma-neg94.6%
metadata-eval94.6%
metadata-eval94.6%
Applied egg-rr94.6%
fma-neg94.6%
Simplified94.6%
add-cube-cbrt94.6%
exp-prod94.6%
Applied egg-rr95.4%
Final simplification95.4%
(FPCore (K m n M l) :precision binary64 (* (cos M) (pow (pow (exp (- (- (fabs (- n m)) l) (pow (- (* (+ m n) 0.5) M) 2.0))) 3.0) 0.3333333333333333)))
double code(double K, double m, double n, double M, double l) {
return cos(M) * pow(pow(exp(((fabs((n - m)) - l) - pow((((m + n) * 0.5) - M), 2.0))), 3.0), 0.3333333333333333);
}
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) * 0.5d0) - m_1) ** 2.0d0))) ** 3.0d0) ** 0.3333333333333333d0)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.pow(Math.pow(Math.exp(((Math.abs((n - m)) - l) - Math.pow((((m + n) * 0.5) - M), 2.0))), 3.0), 0.3333333333333333);
}
def code(K, m, n, M, l): return math.cos(M) * math.pow(math.pow(math.exp(((math.fabs((n - m)) - l) - math.pow((((m + n) * 0.5) - M), 2.0))), 3.0), 0.3333333333333333)
function code(K, m, n, M, l) return Float64(cos(M) * ((exp(Float64(Float64(abs(Float64(n - m)) - l) - (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0))) ^ 3.0) ^ 0.3333333333333333)) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * ((exp(((abs((n - m)) - l) - ((((m + n) * 0.5) - M) ^ 2.0))) ^ 3.0) ^ 0.3333333333333333); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Power[N[Power[N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], 3.0], $MachinePrecision], 0.3333333333333333], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot {\left({\left(e^{\left(\left|n - m\right| - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}}\right)}^{3}\right)}^{0.3333333333333333}
\end{array}
Initial program 77.2%
associate-/l*77.6%
+-commutative77.6%
associate-/l*77.2%
associate-/l*77.6%
+-commutative77.6%
exp-diff29.9%
sub-neg29.9%
exp-sum24.4%
associate-/r*24.4%
exp-diff29.9%
Simplified77.6%
Taylor expanded in K around 0 95.4%
cos-neg95.4%
Simplified95.4%
add-sqr-sqrt95.4%
sqrt-unprod94.6%
pow-prod-up94.6%
div-inv94.6%
fma-neg94.6%
metadata-eval94.6%
metadata-eval94.6%
Applied egg-rr94.6%
fma-neg94.6%
Simplified94.6%
add-cbrt-cube94.6%
pow1/394.6%
Applied egg-rr95.4%
Final simplification95.4%
(FPCore (K m n M l) :precision binary64 (* (cos M) (pow E (- (- (fabs (- n m)) l) (pow (- (* (+ m n) 0.5) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * pow(((double) M_E), ((fabs((n - m)) - l) - pow((((m + n) * 0.5) - M), 2.0)));
}
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.pow(Math.E, ((Math.abs((n - m)) - l) - Math.pow((((m + n) * 0.5) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.pow(math.e, ((math.fabs((n - m)) - l) - math.pow((((m + n) * 0.5) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * (exp(1) ^ Float64(Float64(abs(Float64(n - m)) - l) - (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * (2.71828182845904523536 ^ ((abs((n - m)) - l) - ((((m + n) * 0.5) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Power[E, N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot {e}^{\left(\left(\left|n - m\right| - \ell\right) - {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}
\end{array}
Initial program 77.2%
associate-/l*77.6%
+-commutative77.6%
associate-/l*77.2%
associate-/l*77.6%
+-commutative77.6%
exp-diff29.9%
sub-neg29.9%
exp-sum24.4%
associate-/r*24.4%
exp-diff29.9%
Simplified77.6%
Taylor expanded in K around 0 95.4%
cos-neg95.4%
Simplified95.4%
add-sqr-sqrt95.4%
sqrt-unprod94.6%
pow-prod-up94.6%
div-inv94.6%
fma-neg94.6%
metadata-eval94.6%
metadata-eval94.6%
Applied egg-rr94.6%
fma-neg94.6%
Simplified94.6%
fabs-sub94.6%
*-un-lft-identity94.6%
fabs-sub94.6%
exp-prod94.6%
exp-1-e94.6%
fabs-sub94.6%
associate-+l-94.6%
sqrt-pow195.4%
metadata-eval95.4%
fabs-sub95.4%
Applied egg-rr95.4%
Final simplification95.4%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (fabs (- n m)) (+ l (pow (- (/ (+ m n) 2.0) M) 2.0))))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((fabs((n - m)) - (l + pow((((m + n) / 2.0) - M), 2.0))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp((abs((n - m)) - (l + ((((m + n) / 2.0d0) - m_1) ** 2.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((Math.abs((n - m)) - (l + Math.pow((((m + n) / 2.0) - M), 2.0))));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((math.fabs((n - m)) - (l + math.pow((((m + n) / 2.0) - M), 2.0))))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(abs(Float64(n - m)) - Float64(l + (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0))))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((abs((n - m)) - (l + ((((m + n) / 2.0) - M) ^ 2.0)))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(l + N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left|n - m\right| - \left(\ell + {\left(\frac{m + n}{2} - M\right)}^{2}\right)}
\end{array}
Initial program 77.2%
associate-/l*77.6%
+-commutative77.6%
associate-/l*77.2%
associate-/l*77.6%
+-commutative77.6%
exp-diff29.9%
sub-neg29.9%
exp-sum24.4%
associate-/r*24.4%
exp-diff29.9%
Simplified77.6%
Taylor expanded in K around 0 95.4%
cos-neg95.4%
Simplified95.4%
Final simplification95.4%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos M) (exp (* m (- M (* n 0.5))))))
(t_1 (* (cos M) (exp (- (pow M 2.0)))))
(t_2 (- (* (+ m n) 0.5) M)))
(if (<= M -0.086)
t_1
(if (<= M 2.6e-291)
(exp (- l))
(if (<= M 1.45e-170)
t_0
(if (<= M 1.2e-59)
(*
(cos (- (/ K (/ 2.0 (+ m n))) M))
(exp (+ (- n m) (- (* t_2 t_2) l))))
(if (<= M 26.0) t_0 t_1)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos(M) * exp((m * (M - (n * 0.5))));
double t_1 = cos(M) * exp(-pow(M, 2.0));
double t_2 = ((m + n) * 0.5) - M;
double tmp;
if (M <= -0.086) {
tmp = t_1;
} else if (M <= 2.6e-291) {
tmp = exp(-l);
} else if (M <= 1.45e-170) {
tmp = t_0;
} else if (M <= 1.2e-59) {
tmp = cos(((K / (2.0 / (m + n))) - M)) * exp(((n - m) + ((t_2 * t_2) - l)));
} else if (M <= 26.0) {
tmp = 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) :: t_2
real(8) :: tmp
t_0 = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
t_1 = cos(m_1) * exp(-(m_1 ** 2.0d0))
t_2 = ((m + n) * 0.5d0) - m_1
if (m_1 <= (-0.086d0)) then
tmp = t_1
else if (m_1 <= 2.6d-291) then
tmp = exp(-l)
else if (m_1 <= 1.45d-170) then
tmp = t_0
else if (m_1 <= 1.2d-59) then
tmp = cos(((k / (2.0d0 / (m + n))) - m_1)) * exp(((n - m) + ((t_2 * t_2) - l)))
else if (m_1 <= 26.0d0) then
tmp = 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.cos(M) * Math.exp((m * (M - (n * 0.5))));
double t_1 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double t_2 = ((m + n) * 0.5) - M;
double tmp;
if (M <= -0.086) {
tmp = t_1;
} else if (M <= 2.6e-291) {
tmp = Math.exp(-l);
} else if (M <= 1.45e-170) {
tmp = t_0;
} else if (M <= 1.2e-59) {
tmp = Math.cos(((K / (2.0 / (m + n))) - M)) * Math.exp(((n - m) + ((t_2 * t_2) - l)));
} else if (M <= 26.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos(M) * math.exp((m * (M - (n * 0.5)))) t_1 = math.cos(M) * math.exp(-math.pow(M, 2.0)) t_2 = ((m + n) * 0.5) - M tmp = 0 if M <= -0.086: tmp = t_1 elif M <= 2.6e-291: tmp = math.exp(-l) elif M <= 1.45e-170: tmp = t_0 elif M <= 1.2e-59: tmp = math.cos(((K / (2.0 / (m + n))) - M)) * math.exp(((n - m) + ((t_2 * t_2) - l))) elif M <= 26.0: tmp = t_0 else: tmp = t_1 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))) t_1 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) t_2 = Float64(Float64(Float64(m + n) * 0.5) - M) tmp = 0.0 if (M <= -0.086) tmp = t_1; elseif (M <= 2.6e-291) tmp = exp(Float64(-l)); elseif (M <= 1.45e-170) tmp = t_0; elseif (M <= 1.2e-59) tmp = Float64(cos(Float64(Float64(K / Float64(2.0 / Float64(m + n))) - M)) * exp(Float64(Float64(n - m) + Float64(Float64(t_2 * t_2) - l)))); elseif (M <= 26.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos(M) * exp((m * (M - (n * 0.5)))); t_1 = cos(M) * exp(-(M ^ 2.0)); t_2 = ((m + n) * 0.5) - M; tmp = 0.0; if (M <= -0.086) tmp = t_1; elseif (M <= 2.6e-291) tmp = exp(-l); elseif (M <= 1.45e-170) tmp = t_0; elseif (M <= 1.2e-59) tmp = cos(((K / (2.0 / (m + n))) - M)) * exp(((n - m) + ((t_2 * t_2) - l))); elseif (M <= 26.0) tmp = t_0; else tmp = t_1; end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$2 = N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision]}, If[LessEqual[M, -0.086], t$95$1, If[LessEqual[M, 2.6e-291], N[Exp[(-l)], $MachinePrecision], If[LessEqual[M, 1.45e-170], t$95$0, If[LessEqual[M, 1.2e-59], N[(N[Cos[N[(N[(K / N[(2.0 / N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(n - m), $MachinePrecision] + N[(N[(t$95$2 * t$95$2), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 26.0], t$95$0, t$95$1]]]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
t_1 := \cos M \cdot e^{-{M}^{2}}\\
t_2 := \left(m + n\right) \cdot 0.5 - M\\
\mathbf{if}\;M \leq -0.086:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;M \leq 2.6 \cdot 10^{-291}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{elif}\;M \leq 1.45 \cdot 10^{-170}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 1.2 \cdot 10^{-59}:\\
\;\;\;\;\cos \left(\frac{K}{\frac{2}{m + n}} - M\right) \cdot e^{\left(n - m\right) + \left(t\_2 \cdot t\_2 - \ell\right)}\\
\mathbf{elif}\;M \leq 26:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if M < -0.085999999999999993 or 26 < M Initial program 81.1%
associate-/l*81.1%
+-commutative81.1%
associate-/l*81.1%
associate-/l*81.1%
+-commutative81.1%
exp-diff26.5%
sub-neg26.5%
exp-sum18.9%
associate-/r*18.9%
exp-diff27.3%
Simplified81.1%
Taylor expanded in K around 0 99.2%
cos-neg99.2%
Simplified99.2%
Taylor expanded in M around inf 97.0%
mul-1-neg72.8%
Simplified97.0%
if -0.085999999999999993 < M < 2.5999999999999999e-291Initial program 73.2%
associate-/l*73.2%
+-commutative73.2%
associate-/l*73.2%
associate-/l*73.2%
+-commutative73.2%
exp-diff34.2%
sub-neg34.2%
exp-sum32.5%
associate-/r*32.5%
exp-diff32.5%
Simplified73.2%
Taylor expanded in K around 0 90.6%
cos-neg90.6%
Simplified90.6%
Taylor expanded in l around inf 46.1%
neg-mul-146.1%
Simplified46.1%
Taylor expanded in M around 0 46.1%
if 2.5999999999999999e-291 < M < 1.45e-170 or 1.20000000000000008e-59 < M < 26Initial program 65.0%
associate-/l*68.0%
+-commutative68.0%
associate-/l*65.0%
associate-/l*68.0%
+-commutative68.0%
exp-diff16.5%
sub-neg16.5%
exp-sum13.4%
associate-/r*13.4%
exp-diff16.5%
Simplified68.0%
Taylor expanded in K around 0 92.1%
cos-neg92.1%
Simplified92.1%
Taylor expanded in m around 0 62.2%
+-commutative62.2%
unpow262.2%
distribute-rgt-out65.3%
*-commutative65.3%
*-commutative65.3%
Simplified65.3%
Taylor expanded in m around inf 56.7%
if 1.45e-170 < M < 1.20000000000000008e-59Initial program 81.0%
associate-/l*81.0%
+-commutative81.0%
associate-/l*81.0%
associate-/l*81.0%
+-commutative81.0%
exp-diff49.7%
sub-neg49.7%
exp-sum43.5%
associate-/r*43.5%
exp-diff49.7%
Simplified81.0%
*-un-lft-identity81.0%
*-commutative81.0%
Applied egg-rr53.7%
*-rgt-identity53.7%
associate--r-53.7%
+-commutative53.7%
fma-neg53.7%
Simplified53.7%
clear-num54.3%
un-div-inv57.4%
Applied egg-rr57.4%
unpow257.4%
Applied egg-rr57.4%
Final simplification75.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- M (* n 0.5))))
(if (<= m -27000.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(* (cos M) (exp (+ (fabs (- n m)) (- (* (- m t_0) t_0) l)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = M - (n * 0.5);
double tmp;
if (m <= -27000.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp((fabs((n - m)) + (((m - t_0) * t_0) - l)));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: t_0
real(8) :: tmp
t_0 = m_1 - (n * 0.5d0)
if (m <= (-27000.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp((abs((n - m)) + (((m - t_0) * t_0) - l)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = M - (n * 0.5);
double tmp;
if (m <= -27000.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp((Math.abs((n - m)) + (((m - t_0) * t_0) - l)));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = M - (n * 0.5) tmp = 0 if m <= -27000.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp((math.fabs((n - m)) + (((m - t_0) * t_0) - l))) return tmp
function code(K, m, n, M, l) t_0 = Float64(M - Float64(n * 0.5)) tmp = 0.0 if (m <= -27000.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(abs(Float64(n - m)) + Float64(Float64(Float64(m - t_0) * t_0) - 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 <= -27000.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp((abs((n - m)) + (((m - t_0) * t_0) - 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, -27000.0], 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[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] + N[(N[(N[(m - t$95$0), $MachinePrecision] * t$95$0), $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := M - n \cdot 0.5\\
\mathbf{if}\;m \leq -27000:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left|n - m\right| + \left(\left(m - t\_0\right) \cdot t\_0 - \ell\right)}\\
\end{array}
\end{array}
if m < -27000Initial program 73.6%
associate-/l*73.6%
+-commutative73.6%
associate-/l*73.6%
associate-/l*73.6%
+-commutative73.6%
exp-diff9.4%
sub-neg9.4%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
Simplified73.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
if -27000 < m Initial program 78.1%
associate-/l*78.6%
+-commutative78.6%
associate-/l*78.1%
associate-/l*78.6%
+-commutative78.6%
exp-diff35.2%
sub-neg35.2%
exp-sum30.8%
associate-/r*30.8%
exp-diff37.7%
Simplified78.6%
Taylor expanded in K around 0 94.2%
cos-neg94.2%
Simplified94.2%
Taylor expanded in m around 0 77.1%
+-commutative77.1%
unpow277.1%
distribute-rgt-out82.6%
*-commutative82.6%
*-commutative82.6%
Simplified82.6%
Final simplification86.2%
(FPCore (K m n M l) :precision binary64 (if (<= m -75.0) (* (cos M) (exp (* -0.25 (pow m 2.0)))) (* (cos M) (exp (- (- (fabs (- n m)) l) (* 0.5 (* n (+ m (* n 0.5)))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -75.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = cos(M) * exp(((fabs((n - m)) - l) - (0.5 * (n * (m + (n * 0.5))))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-75.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = cos(m_1) * exp(((abs((n - m)) - l) - (0.5d0 * (n * (m + (n * 0.5d0))))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -75.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) * Math.exp(((Math.abs((n - m)) - l) - (0.5 * (n * (m + (n * 0.5))))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -75.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) * math.exp(((math.fabs((n - m)) - l) - (0.5 * (n * (m + (n * 0.5)))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -75.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(abs(Float64(n - m)) - l) - Float64(0.5 * Float64(n * Float64(m + Float64(n * 0.5))))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -75.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) * exp(((abs((n - m)) - l) - (0.5 * (n * (m + (n * 0.5)))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -75.0], 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[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(0.5 * N[(n * N[(m + N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -75:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(\left|n - m\right| - \ell\right) - 0.5 \cdot \left(n \cdot \left(m + n \cdot 0.5\right)\right)}\\
\end{array}
\end{array}
if m < -75Initial program 73.6%
associate-/l*73.6%
+-commutative73.6%
associate-/l*73.6%
associate-/l*73.6%
+-commutative73.6%
exp-diff9.4%
sub-neg9.4%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
Simplified73.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
if -75 < m Initial program 78.1%
associate-/l*78.6%
+-commutative78.6%
associate-/l*78.1%
associate-/l*78.6%
+-commutative78.6%
exp-diff35.2%
sub-neg35.2%
exp-sum30.8%
associate-/r*30.8%
exp-diff37.7%
Simplified78.6%
Taylor expanded in K around 0 94.2%
cos-neg94.2%
Simplified94.2%
Taylor expanded in m around 0 77.1%
+-commutative77.1%
unpow277.1%
distribute-rgt-out82.6%
*-commutative82.6%
*-commutative82.6%
Simplified82.6%
Taylor expanded in M around 0 64.8%
associate--r+64.8%
fabs-sub64.8%
Simplified64.8%
Final simplification72.1%
(FPCore (K m n M l)
:precision binary64
(if (<= m -75.0)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= m -3e-170)
(* (exp (- (pow M 2.0))) (cos (- (* 0.5 (* m K)) M)))
(* (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 <= -75.0) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (m <= -3e-170) {
tmp = exp(-pow(M, 2.0)) * cos(((0.5 * (m * K)) - M));
} 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 <= (-75.0d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= (-3d-170)) then
tmp = exp(-(m_1 ** 2.0d0)) * cos(((0.5d0 * (m * k)) - m_1))
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 <= -75.0) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= -3e-170) {
tmp = Math.exp(-Math.pow(M, 2.0)) * Math.cos(((0.5 * (m * K)) - M));
} 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 <= -75.0: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif m <= -3e-170: tmp = math.exp(-math.pow(M, 2.0)) * math.cos(((0.5 * (m * K)) - M)) 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 <= -75.0) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (m <= -3e-170) tmp = Float64(exp(Float64(-(M ^ 2.0))) * cos(Float64(Float64(0.5 * Float64(m * K)) - M))); 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 <= -75.0) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (m <= -3e-170) tmp = exp(-(M ^ 2.0)) * cos(((0.5 * (m * K)) - M)); else tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -75.0], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -3e-170], N[(N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision] * N[Cos[N[(N[(0.5 * N[(m * K), $MachinePrecision]), $MachinePrecision] - M), $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 -75:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -3 \cdot 10^{-170}:\\
\;\;\;\;e^{-{M}^{2}} \cdot \cos \left(0.5 \cdot \left(m \cdot K\right) - M\right)\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -75Initial program 73.6%
associate-/l*73.6%
+-commutative73.6%
associate-/l*73.6%
associate-/l*73.6%
+-commutative73.6%
exp-diff9.4%
sub-neg9.4%
exp-sum0.0%
associate-/r*0.0%
exp-diff0.0%
Simplified73.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
if -75 < m < -3.00000000000000013e-170Initial program 72.8%
associate-/l*75.5%
+-commutative75.5%
associate-/l*72.8%
associate-/l*75.5%
+-commutative75.5%
exp-diff39.4%
sub-neg39.4%
exp-sum36.6%
associate-/r*36.6%
exp-diff42.2%
Simplified75.5%
Taylor expanded in m around inf 72.8%
distribute-lft-out72.8%
associate-/l*61.6%
Simplified61.6%
Taylor expanded in M around inf 48.2%
mul-1-neg48.2%
Simplified48.2%
Taylor expanded in n around 0 62.7%
*-commutative62.7%
*-commutative62.7%
Simplified62.7%
if -3.00000000000000013e-170 < m Initial program 79.2%
associate-/l*79.2%
+-commutative79.2%
associate-/l*79.2%
associate-/l*79.2%
+-commutative79.2%
exp-diff34.3%
sub-neg34.3%
exp-sum29.5%
associate-/r*29.5%
exp-diff36.7%
Simplified79.2%
Taylor expanded in K around 0 94.7%
cos-neg94.7%
Simplified94.7%
Taylor expanded in n around inf 49.5%
(FPCore (K m n M l)
:precision binary64
(if (<= m -1.85)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= m -2.5e-165)
(* (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 <= -1.85) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (m <= -2.5e-165) {
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 <= (-1.85d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= (-2.5d-165)) 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 <= -1.85) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= -2.5e-165) {
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 <= -1.85: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif m <= -2.5e-165: 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 <= -1.85) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (m <= -2.5e-165) 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 <= -1.85) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (m <= -2.5e-165) 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, -1.85], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, -2.5e-165], 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 -1.85:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq -2.5 \cdot 10^{-165}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -1.8500000000000001Initial program 74.1%
associate-/l*74.1%
+-commutative74.1%
associate-/l*74.1%
associate-/l*74.1%
+-commutative74.1%
exp-diff11.1%
sub-neg11.1%
exp-sum1.9%
associate-/r*1.9%
exp-diff1.9%
Simplified74.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
if -1.8500000000000001 < m < -2.4999999999999999e-165Initial program 72.0%
associate-/l*74.8%
+-commutative74.8%
associate-/l*72.0%
associate-/l*74.8%
+-commutative74.8%
exp-diff37.7%
sub-neg37.7%
exp-sum34.8%
associate-/r*34.8%
exp-diff40.6%
Simplified74.8%
Taylor expanded in K around 0 91.5%
cos-neg91.5%
Simplified91.5%
Taylor expanded in M around inf 61.1%
mul-1-neg46.8%
Simplified61.1%
if -2.4999999999999999e-165 < m Initial program 79.2%
associate-/l*79.2%
+-commutative79.2%
associate-/l*79.2%
associate-/l*79.2%
+-commutative79.2%
exp-diff34.3%
sub-neg34.3%
exp-sum29.5%
associate-/r*29.5%
exp-diff36.7%
Simplified79.2%
Taylor expanded in K around 0 94.7%
cos-neg94.7%
Simplified94.7%
Taylor expanded in n around inf 49.5%
(FPCore (K m n M l)
:precision binary64
(if (<= m -1.85)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= m 2.3e-170)
(* (cos M) (exp (- (pow M 2.0))))
(* (cos M) (exp (* m (- M (* n 0.5))))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1.85) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (m <= 2.3e-170) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if (m <= (-1.85d0)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m <= 2.3d-170) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1.85) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (m <= 2.3e-170) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -1.85: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif m <= 2.3e-170: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -1.85) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (m <= 2.3e-170) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -1.85) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (m <= 2.3e-170) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp((m * (M - (n * 0.5)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -1.85], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 2.3e-170], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1.85:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;m \leq 2.3 \cdot 10^{-170}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < -1.8500000000000001Initial program 74.1%
associate-/l*74.1%
+-commutative74.1%
associate-/l*74.1%
associate-/l*74.1%
+-commutative74.1%
exp-diff11.1%
sub-neg11.1%
exp-sum1.9%
associate-/r*1.9%
exp-diff1.9%
Simplified74.1%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
if -1.8500000000000001 < m < 2.29999999999999987e-170Initial program 80.3%
associate-/l*81.3%
+-commutative81.3%
associate-/l*80.3%
associate-/l*81.3%
+-commutative81.3%
exp-diff46.9%
sub-neg46.9%
exp-sum43.9%
associate-/r*43.9%
exp-diff53.0%
Simplified81.3%
Taylor expanded in K around 0 92.9%
cos-neg92.9%
Simplified92.9%
Taylor expanded in M around inf 57.7%
mul-1-neg44.5%
Simplified57.7%
if 2.29999999999999987e-170 < m Initial program 75.8%
associate-/l*75.8%
+-commutative75.8%
associate-/l*75.8%
associate-/l*75.8%
+-commutative75.8%
exp-diff23.4%
sub-neg23.4%
exp-sum17.6%
associate-/r*17.6%
exp-diff22.4%
Simplified75.8%
Taylor expanded in K around 0 95.3%
cos-neg95.3%
Simplified95.3%
Taylor expanded in m around 0 61.8%
+-commutative61.8%
unpow261.8%
distribute-rgt-out72.5%
*-commutative72.5%
*-commutative72.5%
Simplified72.5%
Taylor expanded in m around inf 41.3%
Final simplification60.0%
(FPCore (K m n M l) :precision binary64 (if (or (<= l -5.2e+214) (not (<= l 105.0))) (exp (- l)) (* (cos M) (exp (* m (- M (* n 0.5)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((l <= -5.2e+214) || !(l <= 105.0)) {
tmp = exp(-l);
} else {
tmp = cos(M) * exp((m * (M - (n * 0.5))));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((l <= (-5.2d+214)) .or. (.not. (l <= 105.0d0))) then
tmp = exp(-l)
else
tmp = cos(m_1) * exp((m * (m_1 - (n * 0.5d0))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((l <= -5.2e+214) || !(l <= 105.0)) {
tmp = Math.exp(-l);
} else {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (l <= -5.2e+214) or not (l <= 105.0): tmp = math.exp(-l) else: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((l <= -5.2e+214) || !(l <= 105.0)) tmp = exp(Float64(-l)); else tmp = Float64(cos(M) * exp(Float64(m * Float64(M - Float64(n * 0.5))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((l <= -5.2e+214) || ~((l <= 105.0))) tmp = exp(-l); else tmp = cos(M) * exp((m * (M - (n * 0.5)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[l, -5.2e+214], N[Not[LessEqual[l, 105.0]], $MachinePrecision]], N[Exp[(-l)], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m * N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.2 \cdot 10^{+214} \lor \neg \left(\ell \leq 105\right):\\
\;\;\;\;e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if l < -5.19999999999999986e214 or 105 < l Initial program 81.0%
associate-/l*81.0%
+-commutative81.0%
associate-/l*81.0%
associate-/l*81.0%
+-commutative81.0%
exp-diff50.6%
sub-neg50.6%
exp-sum32.9%
associate-/r*32.9%
exp-diff39.2%
Simplified81.0%
Taylor expanded in K around 0 98.7%
cos-neg98.7%
Simplified98.7%
Taylor expanded in l around inf 88.8%
neg-mul-188.8%
Simplified88.8%
Taylor expanded in M around 0 88.8%
if -5.19999999999999986e214 < l < 105Initial program 75.4%
associate-/l*76.0%
+-commutative76.0%
associate-/l*75.4%
associate-/l*76.0%
+-commutative76.0%
exp-diff20.6%
sub-neg20.6%
exp-sum20.6%
associate-/r*20.6%
exp-diff25.7%
Simplified76.0%
Taylor expanded in K around 0 93.9%
cos-neg93.9%
Simplified93.9%
Taylor expanded in m around 0 69.3%
+-commutative69.3%
unpow269.3%
distribute-rgt-out76.7%
*-commutative76.7%
*-commutative76.7%
Simplified76.7%
Taylor expanded in m around inf 44.3%
Final simplification58.0%
(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 77.2%
associate-/l*77.6%
+-commutative77.6%
associate-/l*77.2%
associate-/l*77.6%
+-commutative77.6%
exp-diff29.9%
sub-neg29.9%
exp-sum24.4%
associate-/r*24.4%
exp-diff29.9%
Simplified77.6%
Taylor expanded in K around 0 95.4%
cos-neg95.4%
Simplified95.4%
Taylor expanded in l around inf 36.9%
neg-mul-136.9%
Simplified36.9%
(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 77.2%
associate-/l*77.6%
+-commutative77.6%
associate-/l*77.2%
associate-/l*77.6%
+-commutative77.6%
exp-diff29.9%
sub-neg29.9%
exp-sum24.4%
associate-/r*24.4%
exp-diff29.9%
Simplified77.6%
Taylor expanded in K around 0 95.4%
cos-neg95.4%
Simplified95.4%
Taylor expanded in l around inf 36.9%
neg-mul-136.9%
Simplified36.9%
Taylor expanded in M around 0 36.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.2%
associate-/l*77.6%
+-commutative77.6%
associate-/l*77.2%
associate-/l*77.6%
+-commutative77.6%
exp-diff29.9%
sub-neg29.9%
exp-sum24.4%
associate-/r*24.4%
exp-diff29.9%
Simplified77.6%
Taylor expanded in K around 0 95.4%
cos-neg95.4%
Simplified95.4%
Taylor expanded in l around inf 36.9%
neg-mul-136.9%
Simplified36.9%
Taylor expanded in l around 0 8.0%
herbie shell --seed 2024089
(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)))))))