
(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 79.4%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Final simplification98.1%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- (- (- m n) l) (pow (- (* m 0.5) M) 2.0)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((((m - n) - l) - pow(((m * 0.5) - 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((((m - n) - l) - (((m * 0.5d0) - 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((((m - n) - l) - Math.pow(((m * 0.5) - M), 2.0)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((((m - n) - l) - math.pow(((m * 0.5) - M), 2.0)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(Float64(Float64(m - n) - l) - (Float64(Float64(m * 0.5) - M) ^ 2.0)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((((m - n) - l) - (((m * 0.5) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] - N[Power[N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left(\left(m - n\right) - \ell\right) - {\left(m \cdot 0.5 - M\right)}^{2}}
\end{array}
Initial program 79.4%
Taylor expanded in K around 0 98.1%
cos-neg98.1%
Simplified98.1%
Taylor expanded in n around 0 82.3%
associate--r+82.3%
unpow182.3%
sqr-pow40.9%
fabs-sqr40.9%
sqr-pow88.5%
unpow188.5%
*-commutative88.5%
Simplified88.5%
Final simplification88.5%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (exp (* -0.25 (pow m 2.0)))))
(if (<= n 2.7e-198)
t_0
(if (<= n 1.6e-85)
(/ (cos M) (exp l))
(if (<= n 720.0) t_0 (* (cos M) (exp (- n))))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = exp((-0.25 * pow(m, 2.0)));
double tmp;
if (n <= 2.7e-198) {
tmp = t_0;
} else if (n <= 1.6e-85) {
tmp = cos(M) / exp(l);
} else if (n <= 720.0) {
tmp = t_0;
} else {
tmp = cos(M) * exp(-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) :: t_0
real(8) :: tmp
t_0 = exp(((-0.25d0) * (m ** 2.0d0)))
if (n <= 2.7d-198) then
tmp = t_0
else if (n <= 1.6d-85) then
tmp = cos(m_1) / exp(l)
else if (n <= 720.0d0) then
tmp = t_0
else
tmp = cos(m_1) * exp(-n)
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = Math.exp((-0.25 * Math.pow(m, 2.0)));
double tmp;
if (n <= 2.7e-198) {
tmp = t_0;
} else if (n <= 1.6e-85) {
tmp = Math.cos(M) / Math.exp(l);
} else if (n <= 720.0) {
tmp = t_0;
} else {
tmp = Math.cos(M) * Math.exp(-n);
}
return tmp;
}
def code(K, m, n, M, l): t_0 = math.exp((-0.25 * math.pow(m, 2.0))) tmp = 0 if n <= 2.7e-198: tmp = t_0 elif n <= 1.6e-85: tmp = math.cos(M) / math.exp(l) elif n <= 720.0: tmp = t_0 else: tmp = math.cos(M) * math.exp(-n) return tmp
function code(K, m, n, M, l) t_0 = exp(Float64(-0.25 * (m ^ 2.0))) tmp = 0.0 if (n <= 2.7e-198) tmp = t_0; elseif (n <= 1.6e-85) tmp = Float64(cos(M) / exp(l)); elseif (n <= 720.0) tmp = t_0; else tmp = Float64(cos(M) * exp(Float64(-n))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = exp((-0.25 * (m ^ 2.0))); tmp = 0.0; if (n <= 2.7e-198) tmp = t_0; elseif (n <= 1.6e-85) tmp = cos(M) / exp(l); elseif (n <= 720.0) tmp = t_0; else tmp = cos(M) * exp(-n); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]}, If[LessEqual[n, 2.7e-198], t$95$0, If[LessEqual[n, 1.6e-85], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision], If[LessEqual[n, 720.0], t$95$0, N[(N[Cos[M], $MachinePrecision] * N[Exp[(-n)], $MachinePrecision]), $MachinePrecision]]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := e^{-0.25 \cdot {m}^{2}}\\
\mathbf{if}\;n \leq 2.7 \cdot 10^{-198}:\\
\;\;\;\;t\_0\\
\mathbf{elif}\;n \leq 1.6 \cdot 10^{-85}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\mathbf{elif}\;n \leq 720:\\
\;\;\;\;t\_0\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-n}\\
\end{array}
\end{array}
if n < 2.7000000000000002e-198 or 1.60000000000000014e-85 < n < 720Initial program 78.7%
Taylor expanded in K around 0 97.7%
cos-neg97.7%
Simplified97.7%
Taylor expanded in m around inf 58.0%
*-commutative58.0%
Simplified58.0%
Taylor expanded in M around 0 58.0%
if 2.7000000000000002e-198 < n < 1.60000000000000014e-85Initial program 85.8%
Taylor expanded in l around inf 58.0%
mul-1-neg58.0%
Simplified58.0%
Taylor expanded in K around 0 59.0%
cos-neg59.0%
exp-neg59.0%
associate-*r/59.0%
*-rgt-identity59.0%
Simplified59.0%
if 720 < n Initial program 78.9%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in n around 0 70.6%
associate--r+70.6%
unpow170.6%
sqr-pow14.0%
fabs-sqr14.0%
sqr-pow98.3%
unpow198.3%
*-commutative98.3%
Simplified98.3%
Taylor expanded in n around inf 96.5%
mul-1-neg96.5%
Simplified96.5%
Final simplification66.7%
(FPCore (K m n M l) :precision binary64 (if (or (<= m -0.00013) (not (<= m 55.0))) (exp (* -0.25 (pow m 2.0))) (/ (cos M) (exp l))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((m <= -0.00013) || !(m <= 55.0)) {
tmp = exp((-0.25 * pow(m, 2.0)));
} 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 ((m <= (-0.00013d0)) .or. (.not. (m <= 55.0d0))) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
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 ((m <= -0.00013) || !(m <= 55.0)) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.cos(M) / Math.exp(l);
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (m <= -0.00013) or not (m <= 55.0): tmp = math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.cos(M) / math.exp(l) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((m <= -0.00013) || !(m <= 55.0)) tmp = exp(Float64(-0.25 * (m ^ 2.0))); else tmp = Float64(cos(M) / exp(l)); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((m <= -0.00013) || ~((m <= 55.0))) tmp = exp((-0.25 * (m ^ 2.0))); else tmp = cos(M) / exp(l); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[m, -0.00013], N[Not[LessEqual[m, 55.0]], $MachinePrecision]], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] / N[Exp[l], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -0.00013 \lor \neg \left(m \leq 55\right):\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;\frac{\cos M}{e^{\ell}}\\
\end{array}
\end{array}
if m < -1.29999999999999989e-4 or 55 < m Initial program 73.6%
Taylor expanded in K around 0 98.4%
cos-neg98.4%
Simplified98.4%
Taylor expanded in m around inf 94.5%
*-commutative94.5%
Simplified94.5%
Taylor expanded in M around 0 94.5%
if -1.29999999999999989e-4 < m < 55Initial program 84.9%
Taylor expanded in l around inf 40.3%
mul-1-neg40.3%
Simplified40.3%
Taylor expanded in K around 0 45.8%
cos-neg45.8%
exp-neg45.8%
associate-*r/45.8%
*-rgt-identity45.8%
Simplified45.8%
Final simplification69.6%
(FPCore (K m n M l) :precision binary64 (if (<= m -5e+64) (exp (* -0.25 (pow m 2.0))) (exp (- (- (- m n) l) (pow M 2.0)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (m <= -5e+64) {
tmp = exp((-0.25 * pow(m, 2.0)));
} else {
tmp = exp((((m - n) - l) - pow(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+64)) then
tmp = exp(((-0.25d0) * (m ** 2.0d0)))
else
tmp = exp((((m - n) - l) - (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+64) {
tmp = Math.exp((-0.25 * Math.pow(m, 2.0)));
} else {
tmp = Math.exp((((m - n) - l) - Math.pow(M, 2.0)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if m <= -5e+64: tmp = math.exp((-0.25 * math.pow(m, 2.0))) else: tmp = math.exp((((m - n) - l) - math.pow(M, 2.0))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (m <= -5e+64) tmp = exp(Float64(-0.25 * (m ^ 2.0))); else tmp = exp(Float64(Float64(Float64(m - n) - l) - (M ^ 2.0))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (m <= -5e+64) tmp = exp((-0.25 * (m ^ 2.0))); else tmp = exp((((m - n) - l) - (M ^ 2.0))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[m, -5e+64], N[Exp[N[(-0.25 * N[Power[m, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(N[(N[(m - n), $MachinePrecision] - l), $MachinePrecision] - N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;m \leq -5 \cdot 10^{+64}:\\
\;\;\;\;e^{-0.25 \cdot {m}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left(m - n\right) - \ell\right) - {M}^{2}}\\
\end{array}
\end{array}
if m < -5e64Initial program 72.0%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
Simplified100.0%
Taylor expanded in m around inf 98.0%
*-commutative98.0%
Simplified98.0%
Taylor expanded in M around 0 98.0%
if -5e64 < m Initial program 81.1%
Taylor expanded in K around 0 97.6%
cos-neg97.6%
Simplified97.6%
Taylor expanded in n around 0 78.5%
associate--r+78.5%
unpow178.5%
sqr-pow47.9%
fabs-sqr47.9%
sqr-pow86.1%
unpow186.1%
*-commutative86.1%
Simplified86.1%
Taylor expanded in m around 0 71.8%
Taylor expanded in M around 0 71.8%
Final simplification76.9%
(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(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}
\\
\frac{\cos M}{e^{\ell}}
\end{array}
Initial program 79.4%
Taylor expanded in l around inf 31.1%
mul-1-neg31.1%
Simplified31.1%
Taylor expanded in K around 0 36.9%
cos-neg36.9%
exp-neg36.9%
associate-*r/36.9%
*-rgt-identity36.9%
Simplified36.9%
Final simplification36.9%
(FPCore (K m n M l) :precision binary64 (exp (- l)))
double code(double K, double m, double n, double M, double l) {
return exp(-l);
}
real(8) function code(k, m, n, m_1, l)
real(8), intent (in) :: k
real(8), intent (in) :: m
real(8), intent (in) :: n
real(8), intent (in) :: m_1
real(8), intent (in) :: l
code = exp(-l)
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp(-l);
}
def code(K, m, n, M, l): return math.exp(-l)
function code(K, m, n, M, l) return exp(Float64(-l)) end
function tmp = code(K, m, n, M, l) tmp = exp(-l); end
code[K_, m_, n_, M_, l_] := N[Exp[(-l)], $MachinePrecision]
\begin{array}{l}
\\
e^{-\ell}
\end{array}
Initial program 79.4%
Taylor expanded in l around inf 31.1%
mul-1-neg31.1%
Simplified31.1%
Taylor expanded in n around inf 32.8%
*-commutative32.8%
*-commutative32.8%
associate-*l*32.8%
Simplified32.8%
Taylor expanded in n around 0 36.9%
Final simplification36.9%
(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 79.4%
Taylor expanded in l around inf 31.1%
mul-1-neg31.1%
Simplified31.1%
Taylor expanded in l around 0 8.4%
*-commutative8.4%
*-commutative8.4%
associate-*l*8.4%
Simplified8.4%
Taylor expanded in K around 0 8.9%
cos-neg8.9%
Simplified8.9%
Final simplification8.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 79.4%
Taylor expanded in l around inf 31.1%
mul-1-neg31.1%
Simplified31.1%
Taylor expanded in l around 0 8.4%
*-commutative8.4%
*-commutative8.4%
associate-*l*8.4%
Simplified8.4%
Taylor expanded in K around 0 8.9%
cos-neg8.9%
Simplified8.9%
Taylor expanded in M around 0 8.9%
Final simplification8.9%
herbie shell --seed 2024046
(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)))))))