
(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 (- (- (fabs (- m n)) l) (pow (- (/ (+ m n) 2.0) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp(((fabs((m - n)) - l) - pow((((m + n) / 2.0) - M), 2.0)));
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = cos(m_1) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0d0) - m_1) ** 2.0d0)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(abs(Float64(m - n)) - l) - (Float64(Float64(Float64(m + n) / 2.0) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(N[(m + n), $MachinePrecision] / 2.0), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 71.3%
Taylor expanded in K around 0 96.0%
cos-neg96.0%
Simplified96.0%
Final simplification96.0%
(FPCore (K m n M l) :precision binary64 (if (or (<= M -27.5) (not (<= M 31.5))) (exp (- (pow M 2.0))) (exp (- (- (fabs (- m n)) l) (* 0.25 (pow (+ m n) 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((M <= -27.5) || !(M <= 31.5)) {
tmp = exp(-pow(M, 2.0));
} else {
tmp = exp(((fabs((m - n)) - l) - (0.25 * pow((m + 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 <= (-27.5d0)) .or. (.not. (m_1 <= 31.5d0))) then
tmp = exp(-(m_1 ** 2.0d0))
else
tmp = exp(((abs((m - n)) - l) - (0.25d0 * ((m + 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 <= -27.5) || !(M <= 31.5)) {
tmp = Math.exp(-Math.pow(M, 2.0));
} else {
tmp = Math.exp(((Math.abs((m - n)) - l) - (0.25 * Math.pow((m + n), 2.0))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (M <= -27.5) or not (M <= 31.5): tmp = math.exp(-math.pow(M, 2.0)) else: tmp = math.exp(((math.fabs((m - n)) - l) - (0.25 * math.pow((m + n), 2.0)))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((M <= -27.5) || !(M <= 31.5)) tmp = exp(Float64(-(M ^ 2.0))); else tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(0.25 * (Float64(m + n) ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((M <= -27.5) || ~((M <= 31.5))) tmp = exp(-(M ^ 2.0)); else tmp = exp(((abs((m - n)) - l) - (0.25 * ((m + n) ^ 2.0)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[M, -27.5], N[Not[LessEqual[M, 31.5]], $MachinePrecision]], N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq -27.5 \lor \neg \left(M \leq 31.5\right):\\
\;\;\;\;e^{-{M}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) - 0.25 \cdot {\left(m + n\right)}^{2}}\\
\end{array}
\end{array}
if M < -27.5 or 31.5 < M Initial program 77.1%
Taylor expanded in K around 0 99.1%
cos-neg99.1%
Simplified99.1%
Taylor expanded in M around inf 98.2%
mul-1-neg98.2%
Simplified98.2%
Taylor expanded in M around 0 98.2%
if -27.5 < M < 31.5Initial program 67.0%
Taylor expanded in K around 0 93.7%
cos-neg93.7%
Simplified93.7%
Taylor expanded in M around 0 93.7%
fabs-sub93.7%
associate--r+93.7%
Simplified93.7%
Final simplification95.6%
(FPCore (K m n M l) :precision binary64 (if (<= m -7.2e-9) (* (cos M) (exp (* -0.25 (pow m 2.0)))) (exp (- (- n m) (+ l (* 0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -7.2e-9) {
tmp = cos(M) * exp((-0.25 * pow(m, 2.0)));
} else {
tmp = exp(((n - m) - (l + (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 (m <= (-7.2d-9)) then
tmp = cos(m_1) * exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = exp(((n - m) - (l + (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 (m <= -7.2e-9) {
tmp = Math.cos(M) * Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.exp(((n - m) - (l + (0.25 * (n * n)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -7.2e-9: tmp = math.cos(M) * math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.exp(((n - m) - (l + (0.25 * (n * n))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -7.2e-9) tmp = Float64(cos(M) * exp(Float64(-0.25 * (m ^ 2.0)))); else tmp = exp(Float64(Float64(n - m) - Float64(l + Float64(0.25 * Float64(n * n))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -7.2e-9) tmp = cos(M) * exp((-0.25 * (m ^ 2.0))); else tmp = exp(((n - m) - (l + (0.25 * (n * n))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -7.2e-9], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(n - m), $MachinePrecision] - N[(l + N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -7.2 \cdot 10^{-9}:\\
\;\;\;\;\cos M \cdot e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n - m\right) - \left(\ell + 0.25 \cdot \left(n \cdot n\right)\right)}\\
\end{array}
\end{array}
if m < -7.2e-9Initial program 68.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
if -7.2e-9 < m Initial program 72.3%
Taylor expanded in K around 0 94.5%
cos-neg94.5%
Simplified94.5%
Taylor expanded in M around 0 81.9%
fabs-sub81.9%
associate--r+81.9%
Simplified81.9%
Taylor expanded in m around 0 63.7%
rem-square-sqrt31.5%
fabs-sqr31.5%
rem-square-sqrt80.3%
Simplified80.3%
unpow280.3%
Applied egg-rr80.3%
(FPCore (K m n M l) :precision binary64 (if (<= m -7.2e-9) (exp (* -0.25 (pow m 2.0))) (exp (- (- n m) (+ l (* 0.25 (* n n)))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -7.2e-9) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else {
tmp = exp(((n - m) - (l + (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 (m <= (-7.2d-9)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = exp(((n - m) - (l + (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 (m <= -7.2e-9) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.exp(((n - m) - (l + (0.25 * (n * n)))));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -7.2e-9: tmp = math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.exp(((n - m) - (l + (0.25 * (n * n))))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -7.2e-9) tmp = exp(Float64(-0.25 * (m ^ 2.0))); else tmp = exp(Float64(Float64(n - m) - Float64(l + Float64(0.25 * Float64(n * n))))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -7.2e-9) tmp = exp((-0.25 * (m ^ 2.0))); else tmp = exp(((n - m) - (l + (0.25 * (n * n))))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -7.2e-9], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(n - m), $MachinePrecision] - N[(l + N[(0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -7.2 \cdot 10^{-9}:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(n - m\right) - \left(\ell + 0.25 \cdot \left(n \cdot n\right)\right)}\\
\end{array}
\end{array}
if m < -7.2e-9Initial program 68.6%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in M around 0 100.0%
fabs-sub100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in m around inf 100.0%
*-commutative100.0%
Simplified100.0%
if -7.2e-9 < m Initial program 72.3%
Taylor expanded in K around 0 94.5%
cos-neg94.5%
Simplified94.5%
Taylor expanded in M around 0 81.9%
fabs-sub81.9%
associate--r+81.9%
Simplified81.9%
Taylor expanded in m around 0 63.7%
rem-square-sqrt31.5%
fabs-sqr31.5%
rem-square-sqrt80.3%
Simplified80.3%
unpow280.3%
Applied egg-rr80.3%
Final simplification85.7%
(FPCore (K m n M l) :precision binary64 (if (or (<= n -6.2e-22) (not (<= n 3.4e-13))) (exp (* -0.25 (* n n))) (exp (- l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((n <= -6.2e-22) || !(n <= 3.4e-13)) {
tmp = exp((-0.25 * (n * n)));
} 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 ((n <= (-6.2d-22)) .or. (.not. (n <= 3.4d-13))) then
tmp = exp(((-0.25d0) * (n * n)))
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 ((n <= -6.2e-22) || !(n <= 3.4e-13)) {
tmp = Math.exp((-0.25 * (n * n)));
} else {
tmp = Math.exp(-l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (n <= -6.2e-22) or not (n <= 3.4e-13): tmp = math.exp((-0.25 * (n * n))) else: tmp = math.exp(-l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((n <= -6.2e-22) || !(n <= 3.4e-13)) tmp = exp(Float64(-0.25 * Float64(n * n))); else tmp = exp(Float64(-l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((n <= -6.2e-22) || ~((n <= 3.4e-13))) tmp = exp((-0.25 * (n * n))); else tmp = exp(-l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[n, -6.2e-22], N[Not[LessEqual[n, 3.4e-13]], $MachinePrecision]], N[Exp[N[(-0.25 * N[(n * n), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[(-l)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq -6.2 \cdot 10^{-22} \lor \neg \left(n \leq 3.4 \cdot 10^{-13}\right):\\
\;\;\;\;e^{-0.25 \cdot \left(n \cdot n\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{-\ell}\\
\end{array}
\end{array}
if n < -6.20000000000000025e-22 or 3.40000000000000015e-13 < n Initial program 66.2%
Taylor expanded in K around 0 97.8%
cos-neg97.8%
Simplified97.8%
Taylor expanded in M around 0 92.2%
fabs-sub92.2%
associate--r+92.2%
Simplified92.2%
Taylor expanded in n around inf 91.5%
*-commutative91.5%
Simplified91.5%
unpow285.8%
Applied egg-rr91.5%
if -6.20000000000000025e-22 < n < 3.40000000000000015e-13Initial program 77.3%
Taylor expanded in K around 0 93.8%
cos-neg93.8%
Simplified93.8%
Taylor expanded in M around 0 80.4%
fabs-sub80.4%
associate--r+80.4%
Simplified80.4%
Taylor expanded in m around 0 32.2%
rem-square-sqrt15.5%
fabs-sqr15.5%
rem-square-sqrt51.9%
Simplified51.9%
Taylor expanded in l around inf 45.0%
mul-1-neg45.0%
Simplified45.0%
Final simplification70.3%
(FPCore (K m n M l) :precision binary64 (if (<= m 6e-102) (exp (- l)) (exp (- m))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= 6e-102) {
tmp = exp(-l);
} else {
tmp = exp(-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 <= 6d-102) then
tmp = exp(-l)
else
tmp = exp(-m)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= 6e-102) {
tmp = Math.exp(-l);
} else {
tmp = Math.exp(-m);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= 6e-102: tmp = math.exp(-l) else: tmp = math.exp(-m) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= 6e-102) tmp = exp(Float64(-l)); else tmp = exp(Float64(-m)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= 6e-102) tmp = exp(-l); else tmp = exp(-m); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, 6e-102], N[Exp[(-l)], $MachinePrecision], N[Exp[(-m)], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq 6 \cdot 10^{-102}:\\
\;\;\;\;e^{-\ell}\\
\mathbf{else}:\\
\;\;\;\;e^{-m}\\
\end{array}
\end{array}
if m < 6e-102Initial program 72.6%
Taylor expanded in K around 0 96.1%
cos-neg96.1%
Simplified96.1%
Taylor expanded in M around 0 86.5%
fabs-sub86.5%
associate--r+86.5%
Simplified86.5%
Taylor expanded in m around 0 62.3%
rem-square-sqrt40.6%
fabs-sqr40.6%
rem-square-sqrt62.3%
Simplified62.3%
Taylor expanded in l around inf 39.8%
mul-1-neg39.8%
Simplified39.8%
if 6e-102 < m Initial program 68.8%
Taylor expanded in K around 0 95.9%
cos-neg95.9%
Simplified95.9%
Taylor expanded in M around 0 87.4%
fabs-sub87.4%
associate--r+87.4%
Simplified87.4%
Taylor expanded in m around 0 51.1%
rem-square-sqrt17.2%
fabs-sqr17.2%
rem-square-sqrt84.4%
Simplified84.4%
Taylor expanded in m around inf 72.4%
neg-mul-172.4%
Simplified72.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 71.3%
Taylor expanded in K around 0 96.0%
cos-neg96.0%
Simplified96.0%
Taylor expanded in M around 0 86.8%
fabs-sub86.8%
associate--r+86.8%
Simplified86.8%
Taylor expanded in m around 0 58.2%
rem-square-sqrt32.1%
fabs-sqr32.1%
rem-square-sqrt70.3%
Simplified70.3%
Taylor expanded in l around inf 35.2%
mul-1-neg35.2%
Simplified35.2%
(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 71.3%
Taylor expanded in l around inf 28.0%
mul-1-neg28.0%
Simplified28.0%
Taylor expanded in l around 0 6.0%
*-commutative6.0%
*-commutative6.0%
associate-*l*6.0%
*-commutative6.0%
Simplified6.0%
Taylor expanded in K around 0 6.9%
cos-neg6.9%
Simplified6.9%
(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 71.3%
Taylor expanded in K around 0 96.0%
cos-neg96.0%
Simplified96.0%
Taylor expanded in M around 0 86.8%
fabs-sub86.8%
associate--r+86.8%
Simplified86.8%
Taylor expanded in n around inf 54.6%
*-commutative54.6%
Simplified54.6%
Taylor expanded in n around 0 6.9%
herbie shell --seed 2024149
(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)))))))