
(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
(let* ((t_0
(cbrt
(expm1 (- (- (fabs (- n m)) l) (pow (- (* 0.5 (+ n m)) M) 2.0))))))
(* (cos M) (fma (pow t_0 2.0) t_0 1.0))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cbrt(expm1(((fabs((n - m)) - l) - pow(((0.5 * (n + m)) - M), 2.0))));
return cos(M) * fma(pow(t_0, 2.0), t_0, 1.0);
}
function code(K, m, n, M, l) t_0 = cbrt(expm1(Float64(Float64(abs(Float64(n - m)) - l) - (Float64(Float64(0.5 * Float64(n + m)) - M) ^ 2.0)))) return Float64(cos(M) * fma((t_0 ^ 2.0), t_0, 1.0)) end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Power[N[(Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision], 1/3], $MachinePrecision]}, N[(N[Cos[M], $MachinePrecision] * N[(N[Power[t$95$0, 2.0], $MachinePrecision] * t$95$0 + 1.0), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \sqrt[3]{\mathsf{expm1}\left(\left(\left|n - m\right| - \ell\right) - {\left(0.5 \cdot \left(n + m\right) - M\right)}^{2}\right)}\\
\cos M \cdot \mathsf{fma}\left({t\_0}^{2}, t\_0, 1\right)
\end{array}
\end{array}
Initial program 77.1%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
associate--r+96.8%
*-commutative96.8%
associate--r+96.8%
Simplified96.8%
log1p-expm1-u96.8%
associate--r+96.8%
fabs-sub96.8%
fma-neg96.8%
Applied egg-rr96.8%
log1p-undefine96.8%
rem-exp-log96.8%
fabs-sub96.8%
associate--l-96.8%
fabs-sub96.8%
+-commutative96.8%
Applied egg-rr96.8%
+-commutative96.8%
add-cube-cbrt96.8%
fma-define96.8%
Applied egg-rr96.8%
Final simplification96.8%
(FPCore (K m n M l)
:precision binary64
(*
(cos M)
(+
1.0
(pow
(cbrt (expm1 (- (fabs (- n m)) (+ (pow (fma 0.5 (+ n m) (- M)) 2.0) l))))
3.0))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * (1.0 + pow(cbrt(expm1((fabs((n - m)) - (pow(fma(0.5, (n + m), -M), 2.0) + l)))), 3.0));
}
function code(K, m, n, M, l) return Float64(cos(M) * Float64(1.0 + (cbrt(expm1(Float64(abs(Float64(n - m)) - Float64((fma(0.5, Float64(n + m), Float64(-M)) ^ 2.0) + l)))) ^ 3.0))) end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[(1.0 + N[Power[N[Power[N[(Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(N[Power[N[(0.5 * N[(n + m), $MachinePrecision] + (-M)), $MachinePrecision], 2.0], $MachinePrecision] + l), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision], 1/3], $MachinePrecision], 3.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot \left(1 + {\left(\sqrt[3]{\mathsf{expm1}\left(\left|n - m\right| - \left({\left(\mathsf{fma}\left(0.5, n + m, -M\right)\right)}^{2} + \ell\right)\right)}\right)}^{3}\right)
\end{array}
Initial program 77.1%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
associate--r+96.8%
*-commutative96.8%
associate--r+96.8%
Simplified96.8%
log1p-expm1-u96.8%
associate--r+96.8%
fabs-sub96.8%
fma-neg96.8%
Applied egg-rr96.8%
log1p-undefine96.8%
rem-exp-log96.8%
fabs-sub96.8%
associate--l-96.8%
fabs-sub96.8%
+-commutative96.8%
Applied egg-rr96.8%
+-commutative96.8%
add-cube-cbrt96.8%
fma-define96.8%
Applied egg-rr96.8%
fma-undefine96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos (* 0.5 (* (+ n m) K))) (exp (- (- m l) n))))
(t_1 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= M -27.0)
t_1
(if (<= M 4.4e-195)
t_0
(if (<= M 2e-137)
(* (cos M) (exp (* -0.25 (pow m 2.0))))
(if (<= M 23.0) t_0 t_1))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos((0.5 * ((n + m) * K))) * exp(((m - l) - n));
double t_1 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (M <= -27.0) {
tmp = t_1;
} else if (M <= 4.4e-195) {
tmp = t_0;
} else if (M <= 2e-137) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else if (M <= 23.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) :: tmp
t_0 = cos((0.5d0 * ((n + m) * k))) * exp(((m - l) - n))
t_1 = cos(m_1) * exp(-(m_1 ** 2.0d0))
if (m_1 <= (-27.0d0)) then
tmp = t_1
else if (m_1 <= 4.4d-195) then
tmp = t_0
else if (m_1 <= 2d-137) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else if (m_1 <= 23.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((0.5 * ((n + m) * K))) * Math.exp(((m - l) - n));
double t_1 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double tmp;
if (M <= -27.0) {
tmp = t_1;
} else if (M <= 4.4e-195) {
tmp = t_0;
} else if (M <= 2e-137) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else if (M <= 23.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos((0.5 * ((n + m) * K))) * math.exp(((m - l) - n)) t_1 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if M <= -27.0: tmp = t_1 elif M <= 4.4e-195: tmp = t_0 elif M <= 2e-137: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) elif M <= 23.0: tmp = t_0 else: tmp = t_1 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(Float64(0.5 * Float64(Float64(n + m) * K))) * exp(Float64(Float64(m - l) - n))) t_1 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (M <= -27.0) tmp = t_1; elseif (M <= 4.4e-195) tmp = t_0; elseif (M <= 2e-137) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); elseif (M <= 23.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos((0.5 * ((n + m) * K))) * exp(((m - l) - n)); t_1 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (M <= -27.0) tmp = t_1; elseif (M <= 4.4e-195) tmp = t_0; elseif (M <= 2e-137) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); elseif (M <= 23.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[N[(0.5 * N[(N[(n + m), $MachinePrecision] * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - l), $MachinePrecision] - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -27.0], t$95$1, If[LessEqual[M, 4.4e-195], t$95$0, If[LessEqual[M, 2e-137], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 23.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot \left(\left(n + m\right) \cdot K\right)\right) \cdot e^{\left(m - \ell\right) - n}\\
t_1 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;M \leq -27:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;M \leq 4.4 \cdot 10^{-195}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 2 \cdot 10^{-137}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{elif}\;M \leq 23:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if M < -27 or 23 < M Initial program 80.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in M around inf 98.4%
mul-1-neg98.4%
Simplified98.4%
if -27 < M < 4.40000000000000011e-195 or 1.99999999999999996e-137 < M < 23Initial program 79.1%
*-un-lft-identity79.1%
*-commutative79.1%
Applied egg-rr31.1%
*-rgt-identity31.1%
associate-+l-31.1%
associate--r-31.1%
Simplified31.1%
Taylor expanded in M around inf 54.3%
Taylor expanded in M around 0 54.3%
*-commutative54.3%
+-commutative54.3%
associate--r+54.3%
Simplified54.3%
if 4.40000000000000011e-195 < M < 1.99999999999999996e-137Initial program 26.6%
Taylor expanded in K around 0 91.8%
cos-neg91.8%
associate--r+91.8%
*-commutative91.8%
associate--r+91.8%
Simplified91.8%
Taylor expanded in m around inf 67.6%
Final simplification76.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (cos (* 0.5 (* (+ n m) K))) (exp (- (- m l) n))))
(t_1 (* (cos M) (exp (- (pow M 2.0))))))
(if (<= M -45.0)
t_1
(if (<= M 2.9e-189)
t_0
(if (<= M 6.6e-103)
(* (cos M) (exp (* -0.25 (pow n 2.0))))
(if (<= M 23.0) t_0 t_1))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = cos((0.5 * ((n + m) * K))) * exp(((m - l) - n));
double t_1 = cos(M) * exp(-pow(M, 2.0));
double tmp;
if (M <= -45.0) {
tmp = t_1;
} else if (M <= 2.9e-189) {
tmp = t_0;
} else if (M <= 6.6e-103) {
tmp = cos(M) * exp((-0.25 * pow(n, 2.0)));
} else if (M <= 23.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) :: tmp
t_0 = cos((0.5d0 * ((n + m) * k))) * exp(((m - l) - n))
t_1 = cos(m_1) * exp(-(m_1 ** 2.0d0))
if (m_1 <= (-45.0d0)) then
tmp = t_1
else if (m_1 <= 2.9d-189) then
tmp = t_0
else if (m_1 <= 6.6d-103) then
tmp = cos(m_1) * exp(((-0.25d0) * (n ** 2.0d0)))
else if (m_1 <= 23.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((0.5 * ((n + m) * K))) * Math.exp(((m - l) - n));
double t_1 = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
double tmp;
if (M <= -45.0) {
tmp = t_1;
} else if (M <= 2.9e-189) {
tmp = t_0;
} else if (M <= 6.6e-103) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(n, 2.0)));
} else if (M <= 23.0) {
tmp = t_0;
} else {
tmp = t_1;
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.cos((0.5 * ((n + m) * K))) * math.exp(((m - l) - n)) t_1 = math.cos(M) * math.exp(-math.pow(M, 2.0)) tmp = 0 if M <= -45.0: tmp = t_1 elif M <= 2.9e-189: tmp = t_0 elif M <= 6.6e-103: tmp = math.cos(M) * math.exp((-0.25 * math.pow(n, 2.0))) elif M <= 23.0: tmp = t_0 else: tmp = t_1 return tmp
function code(K, m, n, M, l) t_0 = Float64(cos(Float64(0.5 * Float64(Float64(n + m) * K))) * exp(Float64(Float64(m - l) - n))) t_1 = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))) tmp = 0.0 if (M <= -45.0) tmp = t_1; elseif (M <= 2.9e-189) tmp = t_0; elseif (M <= 6.6e-103) tmp = Float64(cos(M) * exp(Float64(-0.25 * (n ^ 2.0)))); elseif (M <= 23.0) tmp = t_0; else tmp = t_1; end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = cos((0.5 * ((n + m) * K))) * exp(((m - l) - n)); t_1 = cos(M) * exp(-(M ^ 2.0)); tmp = 0.0; if (M <= -45.0) tmp = t_1; elseif (M <= 2.9e-189) tmp = t_0; elseif (M <= 6.6e-103) tmp = cos(M) * exp((-0.25 * (n ^ 2.0))); elseif (M <= 23.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[N[(0.5 * N[(N[(n + m), $MachinePrecision] * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - l), $MachinePrecision] - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]}, If[LessEqual[M, -45.0], t$95$1, If[LessEqual[M, 2.9e-189], t$95$0, If[LessEqual[M, 6.6e-103], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[M, 23.0], t$95$0, t$95$1]]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := \cos \left(0.5 \cdot \left(\left(n + m\right) \cdot K\right)\right) \cdot e^{\left(m - \ell\right) - n}\\
t_1 := \cos M \cdot e^{-{M}^{2}}\\
\mathbf{if}\;M \leq -45:\\
\;\;\;\;t\_1\\
\mathbf{elif}\;M \leq 2.9 \cdot 10^{-189}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;M \leq 6.6 \cdot 10^{-103}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {n}^{2}}\\
\mathbf{elif}\;M \leq 23:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;t\_1\\
\end{array}
\end{array}
if M < -45 or 23 < M Initial program 80.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in M around inf 98.4%
mul-1-neg98.4%
Simplified98.4%
if -45 < M < 2.9e-189 or 6.59999999999999979e-103 < M < 23Initial program 78.8%
*-un-lft-identity78.8%
*-commutative78.8%
Applied egg-rr30.8%
*-rgt-identity30.8%
associate-+l-30.8%
associate--r-30.8%
Simplified30.8%
Taylor expanded in M around inf 52.7%
Taylor expanded in M around 0 52.7%
*-commutative52.7%
+-commutative52.7%
associate--r+52.7%
Simplified52.7%
if 2.9e-189 < M < 6.59999999999999979e-103Initial program 37.1%
Taylor expanded in K around 0 93.0%
cos-neg93.0%
associate--r+93.0%
*-commutative93.0%
associate--r+93.0%
Simplified93.0%
Taylor expanded in n around inf 79.1%
Final simplification76.5%
(FPCore (K m n M l) :precision binary64 (let* ((t_0 (- (* 0.5 (+ n m)) M))) (* (cos M) (+ 1.0 (expm1 (- (fabs (- n m)) (+ l (* t_0 t_0))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (0.5 * (n + m)) - M;
return cos(M) * (1.0 + expm1((fabs((n - m)) - (l + (t_0 * t_0)))));
}
public static double code(double K, double m, double n, double M, double l) {
double t_0 = (0.5 * (n + m)) - M;
return Math.cos(M) * (1.0 + Math.expm1((Math.abs((n - m)) - (l + (t_0 * t_0)))));
}
def code(K, m, n, M, l): t_0 = (0.5 * (n + m)) - M return math.cos(M) * (1.0 + math.expm1((math.fabs((n - m)) - (l + (t_0 * t_0)))))
function code(K, m, n, M, l) t_0 = Float64(Float64(0.5 * Float64(n + m)) - M) return Float64(cos(M) * Float64(1.0 + expm1(Float64(abs(Float64(n - m)) - Float64(l + Float64(t_0 * t_0)))))) end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]}, N[(N[Cos[M], $MachinePrecision] * N[(1.0 + N[(Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(l + N[(t$95$0 * t$95$0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]] - 1), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := 0.5 \cdot \left(n + m\right) - M\\
\cos M \cdot \left(1 + \mathsf{expm1}\left(\left|n - m\right| - \left(\ell + t\_0 \cdot t\_0\right)\right)\right)
\end{array}
\end{array}
Initial program 77.1%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
associate--r+96.8%
*-commutative96.8%
associate--r+96.8%
Simplified96.8%
log1p-expm1-u96.8%
associate--r+96.8%
fabs-sub96.8%
fma-neg96.8%
Applied egg-rr96.8%
log1p-undefine96.8%
rem-exp-log96.8%
fabs-sub96.8%
associate--l-96.8%
fabs-sub96.8%
+-commutative96.8%
Applied egg-rr96.8%
+-commutative96.8%
fma-neg96.8%
unpow296.8%
*-commutative96.8%
+-commutative96.8%
*-commutative96.8%
+-commutative96.8%
Applied egg-rr96.8%
Final simplification96.8%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -1.4e+62) (not (<= M 40.0))) (* (cos M) (exp (- (pow M 2.0)))) (* (cos M) (exp (- (+ m (pow M 2.0)) (+ n l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -1.4e+62) || !(M <= 40.0)) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos(M) * exp(((m + pow(M, 2.0)) - (n + 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 ((m_1 <= (-1.4d+62)) .or. (.not. (m_1 <= 40.0d0))) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos(m_1) * exp(((m + (m_1 ** 2.0d0)) - (n + l)))
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.4e+62) || !(M <= 40.0)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos(M) * Math.exp(((m + Math.pow(M, 2.0)) - (n + l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -1.4e+62) or not (M <= 40.0): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos(M) * math.exp(((m + math.pow(M, 2.0)) - (n + l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -1.4e+62) || !(M <= 40.0)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(M) * exp(Float64(Float64(m + (M ^ 2.0)) - Float64(n + l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -1.4e+62) || ~((M <= 40.0))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos(M) * exp(((m + (M ^ 2.0)) - (n + l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -1.4e+62], N[Not[LessEqual[M, 40.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(m + N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision] - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -1.4 \cdot 10^{+62} \lor \neg \left(M \leq 40\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{\left(m + {M}^{2}\right) - \left(n + \ell\right)}\\
\end{array}
\end{array}
if M < -1.40000000000000007e62 or 40 < M Initial program 80.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in M around inf 99.2%
mul-1-neg99.2%
Simplified99.2%
if -1.40000000000000007e62 < M < 40Initial program 74.0%
*-un-lft-identity74.0%
*-commutative74.0%
Applied egg-rr28.7%
*-rgt-identity28.7%
associate-+l-28.7%
associate--r-28.7%
Simplified28.7%
Taylor expanded in M around inf 51.0%
Taylor expanded in K around 0 64.4%
cos-neg64.4%
+-commutative64.4%
Simplified64.4%
Final simplification80.6%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -27.0) (not (<= M 23.0))) (* (cos M) (exp (- (pow M 2.0)))) (* (cos (* 0.5 (* (+ n m) K))) (exp (- (- m l) n)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -27.0) || !(M <= 23.0)) {
tmp = cos(M) * exp(-pow(M, 2.0));
} else {
tmp = cos((0.5 * ((n + m) * K))) * exp(((m - l) - n));
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m_1 <= (-27.0d0)) .or. (.not. (m_1 <= 23.0d0))) then
tmp = cos(m_1) * exp(-(m_1 ** 2.0d0))
else
tmp = cos((0.5d0 * ((n + m) * k))) * exp(((m - l) - n))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -27.0) || !(M <= 23.0)) {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.cos((0.5 * ((n + m) * K))) * Math.exp(((m - l) - n));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -27.0) or not (M <= 23.0): tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) else: tmp = math.cos((0.5 * ((n + m) * K))) * math.exp(((m - l) - n)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -27.0) || !(M <= 23.0)) tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); else tmp = Float64(cos(Float64(0.5 * Float64(Float64(n + m) * K))) * exp(Float64(Float64(m - l) - n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -27.0) || ~((M <= 23.0))) tmp = cos(M) * exp(-(M ^ 2.0)); else tmp = cos((0.5 * ((n + m) * K))) * exp(((m - l) - n)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -27.0], N[Not[LessEqual[M, 23.0]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision], N[(N[Cos[N[(0.5 * N[(N[(n + m), $MachinePrecision] * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - l), $MachinePrecision] - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -27 \lor \neg \left(M \leq 23\right):\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(0.5 \cdot \left(\left(n + m\right) \cdot K\right)\right) \cdot e^{\left(m - \ell\right) - n}\\
\end{array}
\end{array}
if M < -27 or 23 < M Initial program 80.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in M around inf 98.4%
mul-1-neg98.4%
Simplified98.4%
if -27 < M < 23Initial program 74.3%
*-un-lft-identity74.3%
*-commutative74.3%
Applied egg-rr28.5%
*-rgt-identity28.5%
associate-+l-28.5%
associate--r-28.5%
Simplified28.5%
Taylor expanded in M around inf 51.0%
Taylor expanded in M around 0 51.0%
*-commutative51.0%
+-commutative51.0%
associate--r+51.0%
Simplified51.0%
Final simplification74.2%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (* (+ n m) K)))
(if (<= m -1.2e+34)
(* (cos (- (/ t_0 2.0) M)) (exp (- m n)))
(if (<= m 1.95e-119)
(* (cos (* 0.5 t_0)) (exp (- (- m l) n)))
(* (cos M) (exp (* m (- M (* n 0.5)))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = (n + m) * K;
double tmp;
if (m <= -1.2e+34) {
tmp = cos(((t_0 / 2.0) - M)) * exp((m - n));
} else if (m <= 1.95e-119) {
tmp = cos((0.5 * t_0)) * exp(((m - l) - n));
} 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) :: t_0
real(8) :: tmp
t_0 = (n + m) * k
if (m <= (-1.2d+34)) then
tmp = cos(((t_0 / 2.0d0) - m_1)) * exp((m - n))
else if (m <= 1.95d-119) then
tmp = cos((0.5d0 * t_0)) * exp(((m - l) - n))
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 t_0 = (n + m) * K;
double tmp;
if (m <= -1.2e+34) {
tmp = Math.cos(((t_0 / 2.0) - M)) * Math.exp((m - n));
} else if (m <= 1.95e-119) {
tmp = Math.cos((0.5 * t_0)) * Math.exp(((m - l) - n));
} else {
tmp = Math.cos(M) * Math.exp((m * (M - (n * 0.5))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = (n + m) * K tmp = 0 if m <= -1.2e+34: tmp = math.cos(((t_0 / 2.0) - M)) * math.exp((m - n)) elif m <= 1.95e-119: tmp = math.cos((0.5 * t_0)) * math.exp(((m - l) - n)) else: tmp = math.cos(M) * math.exp((m * (M - (n * 0.5)))) return tmp
function code(K, m, n, M, l) t_0 = Float64(Float64(n + m) * K) tmp = 0.0 if (m <= -1.2e+34) tmp = Float64(cos(Float64(Float64(t_0 / 2.0) - M)) * exp(Float64(m - n))); elseif (m <= 1.95e-119) tmp = Float64(cos(Float64(0.5 * t_0)) * exp(Float64(Float64(m - l) - n))); 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) t_0 = (n + m) * K; tmp = 0.0; if (m <= -1.2e+34) tmp = cos(((t_0 / 2.0) - M)) * exp((m - n)); elseif (m <= 1.95e-119) tmp = cos((0.5 * t_0)) * exp(((m - l) - n)); else tmp = cos(M) * exp((m * (M - (n * 0.5)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(N[(n + m), $MachinePrecision] * K), $MachinePrecision]}, If[LessEqual[m, -1.2e+34], N[(N[Cos[N[(N[(t$95$0 / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[m, 1.95e-119], N[(N[Cos[N[(0.5 * t$95$0), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - l), $MachinePrecision] - n), $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}
t_0 := \left(n + m\right) \cdot K\\
\mathbf{if}\;m \leq -1.2 \cdot 10^{+34}:\\
\;\;\;\;\cos \left(\frac{t\_0}{2} - M\right) \cdot e^{m - n}\\
\mathbf{elif}\;m \leq 1.95 \cdot 10^{-119}:\\
\;\;\;\;\cos \left(0.5 \cdot t\_0\right) \cdot e^{\left(m - \ell\right) - n}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < -1.19999999999999993e34Initial program 63.5%
*-un-lft-identity63.5%
*-commutative63.5%
Applied egg-rr4.8%
*-rgt-identity4.8%
associate-+l-4.8%
associate--r-4.8%
Simplified4.8%
Taylor expanded in M around inf 38.9%
Taylor expanded in n around inf 55.9%
if -1.19999999999999993e34 < m < 1.94999999999999995e-119Initial program 84.2%
*-un-lft-identity84.2%
*-commutative84.2%
Applied egg-rr28.4%
*-rgt-identity28.4%
associate-+l-28.4%
associate--r-28.4%
Simplified28.4%
Taylor expanded in M around inf 36.6%
Taylor expanded in M around 0 48.2%
*-commutative48.2%
+-commutative48.2%
associate--r+48.2%
Simplified48.2%
if 1.94999999999999995e-119 < m Initial program 75.4%
Taylor expanded in m around 0 57.7%
unpow257.7%
distribute-rgt-out64.9%
*-commutative64.9%
*-commutative64.9%
Simplified64.9%
Taylor expanded in m around inf 33.4%
Taylor expanded in K around 0 46.3%
cos-neg46.3%
Simplified46.3%
Final simplification49.1%
(FPCore (K m n M l) :precision binary64 (if (<= m 1.95e-119) (* (cos (* 0.5 (* (+ n m) K))) (exp (- (- m l) n))) (* (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.95e-119) {
tmp = cos((0.5 * ((n + m) * K))) * exp(((m - l) - n));
} 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.95d-119) then
tmp = cos((0.5d0 * ((n + m) * k))) * exp(((m - l) - n))
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.95e-119) {
tmp = Math.cos((0.5 * ((n + m) * K))) * Math.exp(((m - l) - n));
} 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.95e-119: tmp = math.cos((0.5 * ((n + m) * K))) * math.exp(((m - l) - n)) 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.95e-119) tmp = Float64(cos(Float64(0.5 * Float64(Float64(n + m) * K))) * exp(Float64(Float64(m - l) - n))); 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.95e-119) tmp = cos((0.5 * ((n + m) * K))) * exp(((m - l) - n)); 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.95e-119], N[(N[Cos[N[(0.5 * N[(N[(n + m), $MachinePrecision] * K), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(m - l), $MachinePrecision] - n), $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.95 \cdot 10^{-119}:\\
\;\;\;\;\cos \left(0.5 \cdot \left(\left(n + m\right) \cdot K\right)\right) \cdot e^{\left(m - \ell\right) - n}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{m \cdot \left(M - n \cdot 0.5\right)}\\
\end{array}
\end{array}
if m < 1.94999999999999995e-119Initial program 77.9%
*-un-lft-identity77.9%
*-commutative77.9%
Applied egg-rr21.2%
*-rgt-identity21.2%
associate-+l-21.2%
associate--r-21.2%
Simplified21.2%
Taylor expanded in M around inf 37.3%
Taylor expanded in M around 0 47.6%
*-commutative47.6%
+-commutative47.6%
associate--r+47.6%
Simplified47.6%
if 1.94999999999999995e-119 < m Initial program 75.4%
Taylor expanded in m around 0 57.7%
unpow257.7%
distribute-rgt-out64.9%
*-commutative64.9%
*-commutative64.9%
Simplified64.9%
Taylor expanded in m around inf 33.4%
Taylor expanded in K around 0 46.3%
cos-neg46.3%
Simplified46.3%
Final simplification47.2%
(FPCore (K m n M l) :precision binary64 (if (<= l 0.245) (* (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 <= 0.245) {
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 <= 0.245d0) 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 <= 0.245) {
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 <= 0.245: 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 <= 0.245) 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 <= 0.245) 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, 0.245], 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 0.245:\\
\;\;\;\;\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 < 0.245Initial program 75.8%
Taylor expanded in m around 0 59.4%
unpow259.4%
distribute-rgt-out64.7%
*-commutative64.7%
*-commutative64.7%
Simplified64.7%
Taylor expanded in m around inf 30.4%
Taylor expanded in K around 0 37.1%
cos-neg37.1%
Simplified37.1%
if 0.245 < l Initial program 82.4%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in l around inf 98.1%
neg-mul-198.1%
Simplified98.1%
Final simplification49.3%
(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.1%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
associate--r+96.8%
*-commutative96.8%
associate--r+96.8%
Simplified96.8%
Taylor expanded in l around inf 32.1%
neg-mul-132.1%
Simplified32.1%
Final simplification32.1%
(FPCore (K m n M l) :precision binary64 (cos (- (* n (* 0.5 K)) M)))
double code(double K, double m, double n, double M, double l) {
return cos(((n * (0.5 * K)) - 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(((n * (0.5d0 * k)) - m_1))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(((n * (0.5 * K)) - M));
}
def code(K, m, n, M, l): return math.cos(((n * (0.5 * K)) - M))
function code(K, m, n, M, l) return cos(Float64(Float64(n * Float64(0.5 * K)) - M)) end
function tmp = code(K, m, n, M, l) tmp = cos(((n * (0.5 * K)) - M)); end
code[K_, m_, n_, M_, l_] := N[Cos[N[(N[(n * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
\cos \left(n \cdot \left(0.5 \cdot K\right) - M\right)
\end{array}
Initial program 77.1%
Taylor expanded in m around 0 63.6%
unpow263.6%
distribute-rgt-out67.9%
*-commutative67.9%
*-commutative67.9%
Simplified67.9%
Taylor expanded in m around inf 29.7%
Taylor expanded in m around 0 7.8%
associate-*r*7.8%
*-commutative7.8%
Simplified7.8%
Final simplification7.8%
herbie shell --seed 2024058
(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)))))))