
(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 9 alternatives:
| Alternative | Accuracy | Speedup |
|---|
(FPCore (K m n M l) :precision binary64 (* (cos (- (/ (* K (+ m n)) 2.0) M)) (exp (- (- (pow (- (/ (+ m n) 2.0) M) 2.0)) (- l (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
return cos((((K * (m + n)) / 2.0) - M)) * exp((-pow((((m + n) / 2.0) - M), 2.0) - (l - fabs((m - n)))));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos((((k * (m + n)) / 2.0d0) - m_1)) * exp((-((((m + n) / 2.0d0) - m_1) ** 2.0d0) - (l - abs((m - n)))))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos((((K * (m + n)) / 2.0) - M)) * Math.exp((-Math.pow((((m + n) / 2.0) - M), 2.0) - (l - Math.abs((m - n)))));
}
def code(K, m, n, M, l): return math.cos((((K * (m + n)) / 2.0) - M)) * math.exp((-math.pow((((m + n) / 2.0) - M), 2.0) - (l - math.fabs((m - n)))))
function code(K, m, n, M, l) return Float64(cos(Float64(Float64(Float64(K * Float64(m + n)) / 2.0) - M)) * exp(Float64(Float64(-(Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)) - Float64(l - abs(Float64(m - n)))))) end
function tmp = code(K, m, n, M, l) tmp = cos((((K * (m + n)) / 2.0) - M)) * exp((-((((m + n) / 2.0) - M) ^ 2.0) - (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[N[(N[(N[(K * N[(m + n), $MachinePrecision]), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[((-N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]) - N[(l - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos \left(\frac{K \cdot \left(m + n\right)}{2} - M\right) \cdot e^{\left(-{\left(\frac{m + n}{2} - M\right)}^{2}\right) - \left(\ell - \left|m - n\right|\right)}
\end{array}
(FPCore (K m n M l) :precision binary64 (/ (cos M) (exp (+ (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(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(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(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(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(M) / exp(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(M) / exp((((((m + n) / 2.0) - M) ^ 2.0) + (l - abs((m - n))))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $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}
\\
\frac{\cos M}{e^{{\left(\frac{m + n}{2} - M\right)}^{2} + \left(\ell - \left|m - n\right|\right)}}
\end{array}
Initial program 77.9%
Simplified77.9%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Final simplification98.0%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -4e+24) (not (<= M 7.8e+95))) (/ (cos M) (exp (* M M))) (/ 1.0 (exp (- (+ l (* 0.25 (* (+ m n) (+ m n)))) (fabs (- m n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -4e+24) || !(M <= 7.8e+95)) {
tmp = cos(M) / exp((M * M));
} else {
tmp = 1.0 / exp(((l + (0.25 * ((m + n) * (m + n)))) - fabs((m - 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 <= (-4d+24)) .or. (.not. (m_1 <= 7.8d+95))) then
tmp = cos(m_1) / exp((m_1 * m_1))
else
tmp = 1.0d0 / exp(((l + (0.25d0 * ((m + n) * (m + n)))) - abs((m - 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 <= -4e+24) || !(M <= 7.8e+95)) {
tmp = Math.cos(M) / Math.exp((M * M));
} else {
tmp = 1.0 / Math.exp(((l + (0.25 * ((m + n) * (m + n)))) - Math.abs((m - n))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -4e+24) or not (M <= 7.8e+95): tmp = math.cos(M) / math.exp((M * M)) else: tmp = 1.0 / math.exp(((l + (0.25 * ((m + n) * (m + n)))) - math.fabs((m - n)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -4e+24) || !(M <= 7.8e+95)) tmp = Float64(cos(M) / exp(Float64(M * M))); else tmp = Float64(1.0 / exp(Float64(Float64(l + Float64(0.25 * Float64(Float64(m + n) * Float64(m + n)))) - abs(Float64(m - n))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -4e+24) || ~((M <= 7.8e+95))) tmp = cos(M) / exp((M * M)); else tmp = 1.0 / exp(((l + (0.25 * ((m + n) * (m + n)))) - abs((m - n)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -4e+24], N[Not[LessEqual[M, 7.8e+95]], $MachinePrecision]], N[(N[Cos[M], $MachinePrecision] / N[Exp[N[(M * M), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Exp[N[(N[(l + N[(0.25 * N[(N[(m + n), $MachinePrecision] * N[(m + n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -4 \cdot 10^{+24} \lor \neg \left(M \leq 7.8 \cdot 10^{+95}\right):\\
\;\;\;\;\frac{\cos M}{e^{M \cdot M}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{\left(\ell + 0.25 \cdot \left(\left(m + n\right) \cdot \left(m + n\right)\right)\right) - \left|m - n\right|}}\\
\end{array}
\end{array}
if M < -3.9999999999999999e24 or 7.7999999999999994e95 < M Initial program 74.7%
Simplified74.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around inf 99.0%
unpow299.0%
Simplified99.0%
if -3.9999999999999999e24 < M < 7.7999999999999994e95Initial program 79.9%
Simplified79.9%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in M around 0 94.9%
unpow294.9%
Applied egg-rr94.9%
Final simplification96.5%
(FPCore (K m n M l) :precision binary64 (if (<= n 2400.0) (exp (- (- (fabs (- m n)) (* 0.25 (* m m))) l)) (/ 1.0 (exp (* 0.25 (* n n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2400.0) {
tmp = exp(((fabs((m - n)) - (0.25 * (m * m))) - l));
} else {
tmp = 1.0 / exp((0.25 * (n * 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 (n <= 2400.0d0) then
tmp = exp(((abs((m - n)) - (0.25d0 * (m * m))) - l))
else
tmp = 1.0d0 / exp((0.25d0 * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2400.0) {
tmp = Math.exp(((Math.abs((m - n)) - (0.25 * (m * m))) - l));
} else {
tmp = 1.0 / Math.exp((0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 2400.0: tmp = math.exp(((math.fabs((m - n)) - (0.25 * (m * m))) - l)) else: tmp = 1.0 / math.exp((0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 2400.0) tmp = exp(Float64(Float64(abs(Float64(m - n)) - Float64(0.25 * Float64(m * m))) - l)); else tmp = Float64(1.0 / exp(Float64(0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 2400.0) tmp = exp(((abs((m - n)) - (0.25 * (m * m))) - l)); else tmp = 1.0 / exp((0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 2400.0], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision], N[(1.0 / N[Exp[N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 2400:\\
\;\;\;\;e^{\left(\left|m - n\right| - 0.25 \cdot \left(m \cdot m\right)\right) - \ell}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{0.25 \cdot \left(n \cdot n\right)}}\\
\end{array}
\end{array}
if n < 2400Initial program 79.3%
Simplified79.3%
Taylor expanded in K around 0 97.4%
cos-neg97.4%
Simplified97.4%
Taylor expanded in M around 0 88.6%
Taylor expanded in n around 0 70.3%
rec-exp70.3%
associate--l+70.3%
*-commutative70.3%
unpow270.3%
Simplified70.3%
if 2400 < n Initial program 73.8%
Simplified73.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification77.8%
(FPCore (K m n M l) :precision binary64 (if (<= m -1550.0) (/ 1.0 (exp (* 0.25 (* m m)))) (/ 1.0 (exp (+ l (- (* 0.25 (* n n)) n))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -1550.0) {
tmp = 1.0 / exp((0.25 * (m * m)));
} else {
tmp = 1.0 / exp((l + ((0.25 * (n * n)) - 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 <= (-1550.0d0)) then
tmp = 1.0d0 / exp((0.25d0 * (m * m)))
else
tmp = 1.0d0 / exp((l + ((0.25d0 * (n * n)) - 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 <= -1550.0) {
tmp = 1.0 / Math.exp((0.25 * (m * m)));
} else {
tmp = 1.0 / Math.exp((l + ((0.25 * (n * n)) - n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -1550.0: tmp = 1.0 / math.exp((0.25 * (m * m))) else: tmp = 1.0 / math.exp((l + ((0.25 * (n * n)) - n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -1550.0) tmp = Float64(1.0 / exp(Float64(0.25 * Float64(m * m)))); else tmp = Float64(1.0 / exp(Float64(l + Float64(Float64(0.25 * Float64(n * n)) - n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -1550.0) tmp = 1.0 / exp((0.25 * (m * m))); else tmp = 1.0 / exp((l + ((0.25 * (n * n)) - n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -1550.0], N[(1.0 / N[Exp[N[(0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(1.0 / N[Exp[N[(l + N[(N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -1550:\\
\;\;\;\;\frac{1}{e^{0.25 \cdot \left(m \cdot m\right)}}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{\ell + \left(0.25 \cdot \left(n \cdot n\right) - n\right)}}\\
\end{array}
\end{array}
if m < -1550Initial program 77.5%
Simplified77.5%
Taylor expanded in K around 0 98.8%
cos-neg98.8%
Simplified98.8%
Taylor expanded in M around 0 98.8%
Taylor expanded in m around inf 96.3%
*-commutative96.3%
unpow296.3%
Simplified96.3%
if -1550 < m Initial program 78.1%
Simplified78.1%
add-cbrt-cube78.1%
pow378.1%
Applied egg-rr77.6%
Taylor expanded in m around 0 77.2%
Taylor expanded in M around 0 62.8%
associate--l+62.8%
*-commutative62.8%
unpow262.8%
Simplified62.8%
Taylor expanded in n around 0 77.8%
Final simplification83.6%
(FPCore (K m n M l) :precision binary64 (if (or (<= m -0.00015) (not (<= m 52.0))) (/ 1.0 (exp (* 0.25 (* m m)))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -0.00015) || !(m <= 52.0)) {
tmp = 1.0 / exp((0.25 * (m * m)));
} else {
tmp = exp(-l);
}
return tmp;
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
real(8) :: tmp
if ((m <= (-0.00015d0)) .or. (.not. (m <= 52.0d0))) then
tmp = 1.0d0 / exp((0.25d0 * (m * m)))
else
tmp = exp(-l)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -0.00015) || !(m <= 52.0)) {
tmp = 1.0 / Math.exp((0.25 * (m * m)));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (m <= -0.00015) or not (m <= 52.0): tmp = 1.0 / math.exp((0.25 * (m * m))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((m <= -0.00015) || !(m <= 52.0)) tmp = Float64(1.0 / exp(Float64(0.25 * Float64(m * m)))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((m <= -0.00015) || ~((m <= 52.0))) tmp = 1.0 / exp((0.25 * (m * m))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -0.00015], N[Not[LessEqual[m, 52.0]], $MachinePrecision]], N[(1.0 / N[Exp[N[(0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00015 \lor \neg \left(m \leq 52\right):\\
\;\;\;\;\frac{1}{e^{0.25 \cdot \left(m \cdot m\right)}}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if m < -1.49999999999999987e-4 or 52 < m Initial program 77.5%
Simplified77.5%
Taylor expanded in K around 0 99.2%
cos-neg99.2%
Simplified99.2%
Taylor expanded in M around 0 97.7%
Taylor expanded in m around inf 96.2%
*-commutative96.2%
unpow296.2%
Simplified96.2%
if -1.49999999999999987e-4 < m < 52Initial program 78.3%
Simplified78.3%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
Simplified96.8%
Taylor expanded in l around inf 47.2%
Taylor expanded in M around 0 46.4%
rec-exp46.4%
Simplified46.4%
Final simplification71.5%
(FPCore (K m n M l) :precision binary64 (if (<= n 2.2e-231) (/ 1.0 (exp (* 0.25 (* m m)))) (if (<= n 54.0) (exp (- l)) (/ 1.0 (exp (* 0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2.2e-231) {
tmp = 1.0 / exp((0.25 * (m * m)));
} else if (n <= 54.0) {
tmp = exp(-l);
} else {
tmp = 1.0 / exp((0.25 * (n * 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 (n <= 2.2d-231) then
tmp = 1.0d0 / exp((0.25d0 * (m * m)))
else if (n <= 54.0d0) then
tmp = exp(-l)
else
tmp = 1.0d0 / exp((0.25d0 * (n * n)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 2.2e-231) {
tmp = 1.0 / Math.exp((0.25 * (m * m)));
} else if (n <= 54.0) {
tmp = Math.exp(-l);
} else {
tmp = 1.0 / Math.exp((0.25 * (n * n)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 2.2e-231: tmp = 1.0 / math.exp((0.25 * (m * m))) elif n <= 54.0: tmp = math.exp(-l) else: tmp = 1.0 / math.exp((0.25 * (n * n))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 2.2e-231) tmp = Float64(1.0 / exp(Float64(0.25 * Float64(m * m)))); elseif (n <= 54.0) tmp = exp(Float64(-l)); else tmp = Float64(1.0 / exp(Float64(0.25 * Float64(n * n)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 2.2e-231) tmp = 1.0 / exp((0.25 * (m * m))); elseif (n <= 54.0) tmp = exp(-l); else tmp = 1.0 / exp((0.25 * (n * n))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 2.2e-231], N[(1.0 / N[Exp[N[(0.25 * N[(m * m), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 54.0], N[Exp[(-l)], $MachinePrecision], N[(1.0 / N[Exp[N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 2.2 \cdot 10^{-231}:\\
\;\;\;\;\frac{1}{e^{0.25 \cdot \left(m \cdot m\right)}}\\
\mathbf{elif}\;n \leq 54:\\
\;\;\;\;e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;\frac{1}{e^{0.25 \cdot \left(n \cdot n\right)}}\\
\end{array}
\end{array}
if n < 2.20000000000000009e-231Initial program 77.1%
Simplified77.1%
Taylor expanded in K around 0 97.8%
cos-neg97.8%
Simplified97.8%
Taylor expanded in M around 0 90.9%
Taylor expanded in m around inf 56.3%
*-commutative56.3%
unpow256.3%
Simplified56.3%
if 2.20000000000000009e-231 < n < 54Initial program 89.1%
Simplified89.1%
Taylor expanded in K around 0 95.5%
cos-neg95.5%
Simplified95.5%
Taylor expanded in l around inf 56.5%
Taylor expanded in M around 0 56.5%
rec-exp56.5%
Simplified56.5%
if 54 < n Initial program 73.8%
Simplified73.8%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
Taylor expanded in n around inf 100.0%
*-commutative100.0%
unpow2100.0%
Simplified100.0%
Final simplification67.4%
(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.9%
Simplified77.9%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in l around inf 40.7%
Taylor expanded in M around 0 40.3%
rec-exp40.3%
Simplified40.3%
Final simplification40.3%
(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.9%
Simplified77.9%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in l around inf 40.7%
Taylor expanded in l around 0 7.3%
Final simplification7.3%
(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 77.9%
Simplified77.9%
Taylor expanded in K around 0 98.0%
cos-neg98.0%
Simplified98.0%
Taylor expanded in l around inf 40.7%
Taylor expanded in l around 0 7.3%
Taylor expanded in M around 0 7.3%
Final simplification7.3%
herbie shell --seed 2023195
(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)))))))