
(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 11 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 (* (exp (- (fabs (- n m)) (+ l (pow (- (* 0.5 (+ n m)) M) 2.0)))) (log1p (expm1 (cos M)))))
double code(double K, double m, double n, double M, double l) {
return exp((fabs((n - m)) - (l + pow(((0.5 * (n + m)) - M), 2.0)))) * log1p(expm1(cos(M)));
}
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((Math.abs((n - m)) - (l + Math.pow(((0.5 * (n + m)) - M), 2.0)))) * Math.log1p(Math.expm1(Math.cos(M)));
}
def code(K, m, n, M, l): return math.exp((math.fabs((n - m)) - (l + math.pow(((0.5 * (n + m)) - M), 2.0)))) * math.log1p(math.expm1(math.cos(M)))
function code(K, m, n, M, l) return Float64(exp(Float64(abs(Float64(n - m)) - Float64(l + (Float64(Float64(0.5 * Float64(n + m)) - M) ^ 2.0)))) * log1p(expm1(cos(M)))) end
code[K_, m_, n_, M_, l_] := N[(N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(l + N[Power[N[(N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Log[1 + N[(Exp[N[Cos[M], $MachinePrecision]] - 1), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\left|n - m\right| - \left(\ell + {\left(0.5 \cdot \left(n + m\right) - M\right)}^{2}\right)} \cdot \mathsf{log1p}\left(\mathsf{expm1}\left(\cos M\right)\right)
\end{array}
Initial program 74.1%
Taylor expanded in K around 0 96.6%
Simplified96.6%
log1p-expm1-u96.6%
Applied egg-rr96.6%
Final simplification96.6%
(FPCore (K m n M l) :precision binary64 (* (exp (- (fabs (- n m)) (+ l (pow (- (* 0.5 (+ n m)) M) 2.0)))) (cos M)))
double code(double K, double m, double n, double M, double l) {
return exp((fabs((n - m)) - (l + pow(((0.5 * (n + m)) - M), 2.0)))) * 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 = exp((abs((n - m)) - (l + (((0.5d0 * (n + m)) - m_1) ** 2.0d0)))) * cos(m_1)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((Math.abs((n - m)) - (l + Math.pow(((0.5 * (n + m)) - M), 2.0)))) * Math.cos(M);
}
def code(K, m, n, M, l): return math.exp((math.fabs((n - m)) - (l + math.pow(((0.5 * (n + m)) - M), 2.0)))) * math.cos(M)
function code(K, m, n, M, l) return Float64(exp(Float64(abs(Float64(n - m)) - Float64(l + (Float64(Float64(0.5 * Float64(n + m)) - M) ^ 2.0)))) * cos(M)) end
function tmp = code(K, m, n, M, l) tmp = exp((abs((n - m)) - (l + (((0.5 * (n + m)) - M) ^ 2.0)))) * cos(M); end
code[K_, m_, n_, M_, l_] := N[(N[Exp[N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - N[(l + N[Power[N[(N[(0.5 * N[(n + m), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision] * N[Cos[M], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
e^{\left|n - m\right| - \left(\ell + {\left(0.5 \cdot \left(n + m\right) - M\right)}^{2}\right)} \cdot \cos M
\end{array}
Initial program 74.1%
Taylor expanded in K around 0 96.6%
Simplified96.6%
Final simplification96.6%
(FPCore (K m n M l)
:precision binary64
(if (or (<= m -5e-30) (not (<= m 7e-77)))
(exp (- (- (fabs (- n m)) l) (* 0.25 (* (+ n m) (+ n m)))))
(*
(cos (- (/ (* (+ n m) K) 2.0) M))
(exp (- (- l) (pow (- (/ (+ n m) 2.0) M) 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -5e-30) || !(m <= 7e-77)) {
tmp = exp(((fabs((n - m)) - l) - (0.25 * ((n + m) * (n + m)))));
} else {
tmp = cos(((((n + m) * K) / 2.0) - M)) * exp((-l - pow((((n + m) / 2.0) - M), 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 <= (-5d-30)) .or. (.not. (m <= 7d-77))) then
tmp = exp(((abs((n - m)) - l) - (0.25d0 * ((n + m) * (n + m)))))
else
tmp = cos(((((n + m) * k) / 2.0d0) - m_1)) * exp((-l - ((((n + m) / 2.0d0) - m_1) ** 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 <= -5e-30) || !(m <= 7e-77)) {
tmp = Math.exp(((Math.abs((n - m)) - l) - (0.25 * ((n + m) * (n + m)))));
} else {
tmp = Math.cos(((((n + m) * K) / 2.0) - M)) * Math.exp((-l - Math.pow((((n + m) / 2.0) - M), 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (m <= -5e-30) or not (m <= 7e-77): tmp = math.exp(((math.fabs((n - m)) - l) - (0.25 * ((n + m) * (n + m))))) else: tmp = math.cos(((((n + m) * K) / 2.0) - M)) * math.exp((-l - math.pow((((n + m) / 2.0) - M), 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((m <= -5e-30) || !(m <= 7e-77)) tmp = exp(Float64(Float64(abs(Float64(n - m)) - l) - Float64(0.25 * Float64(Float64(n + m) * Float64(n + m))))); else tmp = Float64(cos(Float64(Float64(Float64(Float64(n + m) * K) / 2.0) - M)) * exp(Float64(Float64(-l) - (Float64(Float64(Float64(n + m) / 2.0) - M) ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((m <= -5e-30) || ~((m <= 7e-77))) tmp = exp(((abs((n - m)) - l) - (0.25 * ((n + m) * (n + m))))); else tmp = cos(((((n + m) * K) / 2.0) - M)) * exp((-l - ((((n + m) / 2.0) - M) ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -5e-30], N[Not[LessEqual[m, 7e-77]], $MachinePrecision]], N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(0.25 * N[(N[(n + m), $MachinePrecision] * N[(n + m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(N[(N[(N[(n + m), $MachinePrecision] * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-l) - N[Power[N[(N[(N[(n + m), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5 \cdot 10^{-30} \lor \neg \left(m \leq 7 \cdot 10^{-77}\right):\\
\;\;\;\;e^{\left(\left|n - m\right| - \ell\right) - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\frac{\left(n + m\right) \cdot K}{2} - M\right) \cdot e^{\left(-\ell\right) - {\left(\frac{n + m}{2} - M\right)}^{2}}\\
\end{array}
\end{array}
if m < -4.99999999999999972e-30 or 7.00000000000000026e-77 < m Initial program 67.9%
Taylor expanded in K around 0 97.0%
Simplified97.0%
log1p-expm1-u97.0%
Applied egg-rr97.0%
Taylor expanded in M around 0 93.8%
associate--r+93.8%
+-commutative93.8%
Simplified93.8%
unpow293.8%
Applied egg-rr93.8%
if -4.99999999999999972e-30 < m < 7.00000000000000026e-77Initial program 84.5%
Taylor expanded in l around inf 82.9%
Final simplification89.8%
(FPCore (K m n M l) :precision binary64 (if (<= M 8.5e+164) (exp (- (- (fabs (- n m)) l) (* 0.25 (* (+ n m) (+ n m))))) (* (cos (- (/ (* (+ n m) K) 2.0) M)) (exp (* M (+ m (- n M)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= 8.5e+164) {
tmp = exp(((fabs((n - m)) - l) - (0.25 * ((n + m) * (n + m)))));
} else {
tmp = cos(((((n + m) * K) / 2.0) - M)) * exp((M * (m + (n - M))));
}
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 <= 8.5d+164) then
tmp = exp(((abs((n - m)) - l) - (0.25d0 * ((n + m) * (n + m)))))
else
tmp = cos(((((n + m) * k) / 2.0d0) - m_1)) * exp((m_1 * (m + (n - m_1))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= 8.5e+164) {
tmp = Math.exp(((Math.abs((n - m)) - l) - (0.25 * ((n + m) * (n + m)))));
} else {
tmp = Math.cos(((((n + m) * K) / 2.0) - M)) * Math.exp((M * (m + (n - M))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= 8.5e+164: tmp = math.exp(((math.fabs((n - m)) - l) - (0.25 * ((n + m) * (n + m))))) else: tmp = math.cos(((((n + m) * K) / 2.0) - M)) * math.exp((M * (m + (n - M)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= 8.5e+164) tmp = exp(Float64(Float64(abs(Float64(n - m)) - l) - Float64(0.25 * Float64(Float64(n + m) * Float64(n + m))))); else tmp = Float64(cos(Float64(Float64(Float64(Float64(n + m) * K) / 2.0) - M)) * exp(Float64(M * Float64(m + Float64(n - M))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= 8.5e+164) tmp = exp(((abs((n - m)) - l) - (0.25 * ((n + m) * (n + m))))); else tmp = cos(((((n + m) * K) / 2.0) - M)) * exp((M * (m + (n - M)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, 8.5e+164], N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(0.25 * N[(N[(n + m), $MachinePrecision] * N[(n + m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(N[(N[(N[(n + m), $MachinePrecision] * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(M * N[(m + N[(n - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 8.5 \cdot 10^{+164}:\\
\;\;\;\;e^{\left(\left|n - m\right| - \ell\right) - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\frac{\left(n + m\right) \cdot K}{2} - M\right) \cdot e^{M \cdot \left(m + \left(n - M\right)\right)}\\
\end{array}
\end{array}
if M < 8.50000000000000027e164Initial program 72.2%
Taylor expanded in K around 0 96.2%
Simplified96.2%
log1p-expm1-u96.2%
Applied egg-rr96.2%
Taylor expanded in M around 0 85.9%
associate--r+85.9%
+-commutative85.9%
Simplified85.9%
unpow285.9%
Applied egg-rr85.9%
if 8.50000000000000027e164 < M Initial program 89.3%
Taylor expanded in M around inf 89.3%
Taylor expanded in M around 0 89.3%
neg-mul-189.3%
Simplified89.3%
Final simplification86.3%
(FPCore (K m n M l) :precision binary64 (exp (- (- (fabs (- n m)) l) (* 0.25 (* (+ n m) (+ n m))))))
double code(double K, double m, double n, double M, double l) {
return exp(((fabs((n - m)) - l) - (0.25 * ((n + m) * (n + 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 = exp(((abs((n - m)) - l) - (0.25d0 * ((n + m) * (n + m)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(((Math.abs((n - m)) - l) - (0.25 * ((n + m) * (n + m)))));
}
def code(K, m, n, M, l): return math.exp(((math.fabs((n - m)) - l) - (0.25 * ((n + m) * (n + m)))))
function code(K, m, n, M, l) return exp(Float64(Float64(abs(Float64(n - m)) - l) - Float64(0.25 * Float64(Float64(n + m) * Float64(n + m))))) end
function tmp = code(K, m, n, M, l) tmp = exp(((abs((n - m)) - l) - (0.25 * ((n + m) * (n + m))))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(N[(N[Abs[N[(n - m), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(0.25 * N[(N[(n + m), $MachinePrecision] * N[(n + m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{\left(\left|n - m\right| - \ell\right) - 0.25 \cdot \left(\left(n + m\right) \cdot \left(n + m\right)\right)}
\end{array}
Initial program 74.1%
Taylor expanded in K around 0 96.6%
Simplified96.6%
log1p-expm1-u96.6%
Applied egg-rr96.6%
Taylor expanded in M around 0 83.6%
associate--r+83.6%
+-commutative83.6%
Simplified83.6%
unpow283.6%
Applied egg-rr83.6%
(FPCore (K m n M l) :precision binary64 (if (<= m -55.0) (exp (* (pow m 2.0) -0.25)) (if (<= m -8.7e-33) (* (cos M) (exp (- l))) (exp (* -0.25 (pow n 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -55.0) {
tmp = exp((pow(m, 2.0) * -0.25));
} else if (m <= -8.7e-33) {
tmp = cos(M) * exp(-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 (m <= (-55.0d0)) then
tmp = exp(((m ** 2.0d0) * (-0.25d0)))
else if (m <= (-8.7d-33)) then
tmp = cos(m_1) * exp(-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 (m <= -55.0) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else if (m <= -8.7e-33) {
tmp = Math.cos(M) * Math.exp(-l);
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -55.0: tmp = math.exp((math.pow(m, 2.0) * -0.25)) elif m <= -8.7e-33: tmp = math.cos(M) * math.exp(-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 (m <= -55.0) tmp = exp(Float64((m ^ 2.0) * -0.25)); elseif (m <= -8.7e-33) tmp = Float64(cos(M) * exp(Float64(-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 (m <= -55.0) tmp = exp(((m ^ 2.0) * -0.25)); elseif (m <= -8.7e-33) tmp = cos(M) * exp(-l); else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -55.0], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], If[LessEqual[m, -8.7e-33], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-l)], $MachinePrecision]), $MachinePrecision], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -55:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{elif}\;m \leq -8.7 \cdot 10^{-33}:\\
\;\;\;\;\cos M \cdot e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -55Initial program 67.6%
Taylor expanded in K around 0 98.6%
Simplified98.6%
log1p-expm1-u98.6%
Applied egg-rr98.6%
Taylor expanded in M around 0 98.6%
associate--r+98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in m around inf 97.3%
*-commutative97.3%
Simplified97.3%
if -55 < m < -8.7000000000000004e-33Initial program 42.9%
Taylor expanded in l around inf 6.6%
mul-1-neg6.6%
Simplified6.6%
Taylor expanded in K around 0 49.9%
cos-neg49.9%
Simplified49.9%
if -8.7000000000000004e-33 < m Initial program 78.0%
Taylor expanded in K around 0 95.7%
Simplified95.7%
log1p-expm1-u95.7%
Applied egg-rr95.7%
Taylor expanded in M around 0 77.2%
associate--r+77.2%
+-commutative77.2%
Simplified77.2%
Taylor expanded in n around inf 50.9%
*-commutative50.9%
Simplified50.9%
Final simplification64.3%
(FPCore (K m n M l) :precision binary64 (if (<= m -950000000000.0) (exp (* (pow m 2.0) -0.25)) (exp (* -0.25 (pow n 2.0)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -950000000000.0) {
tmp = exp((pow(m, 2.0) * -0.25));
} 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 (m <= (-950000000000.0d0)) then
tmp = exp(((m ** 2.0d0) * (-0.25d0)))
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 (m <= -950000000000.0) {
tmp = Math.exp((Math.pow(m, 2.0) * -0.25));
} else {
tmp = Math.exp((-0.25 * Math.pow(n, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -950000000000.0: tmp = math.exp((math.pow(m, 2.0) * -0.25)) else: tmp = math.exp((-0.25 * math.pow(n, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -950000000000.0) tmp = exp(Float64((m ^ 2.0) * -0.25)); 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 (m <= -950000000000.0) tmp = exp(((m ^ 2.0) * -0.25)); else tmp = exp((-0.25 * (n ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -950000000000.0], N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision], N[Exp[N[(-0.25 * N[Power[n, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -950000000000:\\
\;\;\;\;e^{{m}^{2} \cdot -0.25}\\
\mathbf{else}:\\
\;\;\;\;e^{-0.25 \cdot {n}^{2}}\\
\end{array}
\end{array}
if m < -9.5e11Initial program 66.7%
Taylor expanded in K around 0 98.6%
Simplified98.6%
log1p-expm1-u98.6%
Applied egg-rr98.6%
Taylor expanded in M around 0 98.6%
associate--r+98.6%
+-commutative98.6%
Simplified98.6%
Taylor expanded in m around inf 98.6%
*-commutative98.6%
Simplified98.6%
if -9.5e11 < m Initial program 76.9%
Taylor expanded in K around 0 95.9%
Simplified95.9%
log1p-expm1-u95.9%
Applied egg-rr95.9%
Taylor expanded in M around 0 77.8%
associate--r+77.8%
+-commutative77.8%
Simplified77.8%
Taylor expanded in n around inf 50.9%
*-commutative50.9%
Simplified50.9%
Final simplification64.3%
(FPCore (K m n M l) :precision binary64 (exp (* (pow m 2.0) -0.25)))
double code(double K, double m, double n, double M, double l) {
return exp((pow(m, 2.0) * -0.25));
}
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(((m ** 2.0d0) * (-0.25d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((Math.pow(m, 2.0) * -0.25));
}
def code(K, m, n, M, l): return math.exp((math.pow(m, 2.0) * -0.25))
function code(K, m, n, M, l) return exp(Float64((m ^ 2.0) * -0.25)) end
function tmp = code(K, m, n, M, l) tmp = exp(((m ^ 2.0) * -0.25)); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(N[Power[m, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{{m}^{2} \cdot -0.25}
\end{array}
Initial program 74.1%
Taylor expanded in K around 0 96.6%
Simplified96.6%
log1p-expm1-u96.6%
Applied egg-rr96.6%
Taylor expanded in M around 0 83.6%
associate--r+83.6%
+-commutative83.6%
Simplified83.6%
Taylor expanded in m around inf 56.0%
*-commutative56.0%
Simplified56.0%
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* m K) 2.0) M)) (+ 1.0 (* l (+ (* l (+ 0.5 (* l -0.16666666666666666))) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos((((m * K) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.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 * k) / 2.0d0) - m_1)) * (1.0d0 + (l * ((l * (0.5d0 + (l * (-0.16666666666666666d0)))) + (-1.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((m * K) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)));
}
def code(K, m, n, M, l): return math.cos((((m * K) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(m * K) / 2.0) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * Float64(0.5 + Float64(l * -0.16666666666666666))) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos((((m * K) / 2.0) - M)) * (1.0 + (l * ((l * (0.5 + (l * -0.16666666666666666))) + -1.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(m * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * N[(0.5 + N[(l * -0.16666666666666666), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{m \cdot K}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot \left(0.5 + \ell \cdot -0.16666666666666666\right) + -1\right)\right)
\end{array}
Initial program 74.1%
Taylor expanded in l around inf 24.0%
mul-1-neg24.0%
Simplified24.0%
Taylor expanded in m around inf 27.0%
*-commutative27.0%
Simplified27.0%
Taylor expanded in l around 0 6.7%
Final simplification6.7%
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* m K) 2.0) M)) (+ 1.0 (* l (+ (* l 0.5) -1.0)))))
double code(double K, double m, double n, double M, double l) {
return cos((((m * K) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.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 * k) / 2.0d0) - m_1)) * (1.0d0 + (l * ((l * 0.5d0) + (-1.0d0))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((m * K) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)));
}
def code(K, m, n, M, l): return math.cos((((m * K) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0)))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(m * K) / 2.0) - M)) * Float64(1.0 + Float64(l * Float64(Float64(l * 0.5) + -1.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos((((m * K) / 2.0) - M)) * (1.0 + (l * ((l * 0.5) + -1.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(m * K), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[(1.0 + N[(l * N[(N[(l * 0.5), $MachinePrecision] + -1.0), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{m \cdot K}{2} - M\right) \cdot \left(1 + \ell \cdot \left(\ell \cdot 0.5 + -1\right)\right)
\end{array}
Initial program 74.1%
Taylor expanded in l around inf 24.0%
mul-1-neg24.0%
Simplified24.0%
Taylor expanded in m around inf 27.0%
*-commutative27.0%
Simplified27.0%
Taylor expanded in l around 0 6.4%
Final simplification6.4%
(FPCore (K m n M l) :precision binary64 1.0)
double code(double K, double m, double n, double M, double l) {
return 1.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 = 1.0d0
end function
public static double code(double K, double m, double n, double M, double l) {
return 1.0;
}
def code(K, m, n, M, l): return 1.0
function code(K, m, n, M, l) return 1.0 end
function tmp = code(K, m, n, M, l) tmp = 1.0; end
code[K_, m_, n_, M_, l_] := 1.0
\begin{array}{l}
\\
1
\end{array}
Initial program 74.1%
Taylor expanded in M around inf 41.0%
Taylor expanded in M around 0 4.6%
*-commutative4.6%
Simplified4.6%
Taylor expanded in n around 0 4.9%
*-commutative4.9%
*-commutative4.9%
associate-*l*4.9%
*-commutative4.9%
Simplified4.9%
Taylor expanded in m around 0 5.3%
herbie shell --seed 2024136
(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)))))))