
(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 7 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 78.0%
Taylor expanded in K around 0 96.6%
cos-neg96.6%
Simplified96.6%
Final simplification96.6%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- M (* n 0.5))) (t_1 (- (fabs (- m n)) l)))
(if (<= m -49.0)
(exp (- t_1 (* 0.25 (pow (+ m n) 2.0))))
(exp (- t_1 (* t_0 (- t_0 m)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = M - (n * 0.5);
double t_1 = fabs((m - n)) - l;
double tmp;
if (m <= -49.0) {
tmp = exp((t_1 - (0.25 * pow((m + n), 2.0))));
} else {
tmp = exp((t_1 - (t_0 * (t_0 - 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) :: t_0
real(8) :: t_1
real(8) :: tmp
t_0 = m_1 - (n * 0.5d0)
t_1 = abs((m - n)) - l
if (m <= (-49.0d0)) then
tmp = exp((t_1 - (0.25d0 * ((m + n) ** 2.0d0))))
else
tmp = exp((t_1 - (t_0 * (t_0 - m))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = M - (n * 0.5);
double t_1 = Math.abs((m - n)) - l;
double tmp;
if (m <= -49.0) {
tmp = Math.exp((t_1 - (0.25 * Math.pow((m + n), 2.0))));
} else {
tmp = Math.exp((t_1 - (t_0 * (t_0 - m))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = M - (n * 0.5) t_1 = math.fabs((m - n)) - l tmp = 0 if m <= -49.0: tmp = math.exp((t_1 - (0.25 * math.pow((m + n), 2.0)))) else: tmp = math.exp((t_1 - (t_0 * (t_0 - m)))) return tmp
function code(K, m, n, M, l) t_0 = Float64(M - Float64(n * 0.5)) t_1 = Float64(abs(Float64(m - n)) - l) tmp = 0.0 if (m <= -49.0) tmp = exp(Float64(t_1 - Float64(0.25 * (Float64(m + n) ^ 2.0)))); else tmp = exp(Float64(t_1 - Float64(t_0 * Float64(t_0 - m)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = M - (n * 0.5); t_1 = abs((m - n)) - l; tmp = 0.0; if (m <= -49.0) tmp = exp((t_1 - (0.25 * ((m + n) ^ 2.0)))); else tmp = exp((t_1 - (t_0 * (t_0 - m)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]}, Block[{t$95$1 = N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]}, If[LessEqual[m, -49.0], N[Exp[N[(t$95$1 - N[(0.25 * N[Power[N[(m + n), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[Exp[N[(t$95$1 - N[(t$95$0 * N[(t$95$0 - m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := M - n \cdot 0.5\\
t_1 := \left|m - n\right| - \ell\\
\mathbf{if}\;m \leq -49:\\
\;\;\;\;e^{t\_1 - 0.25 \cdot {\left(m + n\right)}^{2}}\\
\mathbf{else}:\\
\;\;\;\;e^{t\_1 - t\_0 \cdot \left(t\_0 - m\right)}\\
\end{array}
\end{array}
if m < -49Initial program 81.3%
Taylor expanded in K around 0 83.3%
cos-neg83.3%
*-commutative83.3%
associate-*l*83.3%
metadata-eval83.3%
distribute-rgt-neg-in83.3%
*-commutative83.3%
associate-*r*83.3%
distribute-lft-neg-in83.3%
sin-neg83.3%
distribute-rgt-neg-out83.3%
remove-double-neg83.3%
Simplified83.3%
Taylor expanded in M around 0 100.0%
associate--r+100.0%
+-commutative100.0%
Simplified100.0%
if -49 < m Initial program 77.2%
Taylor expanded in M around 0 77.2%
*-commutative77.2%
*-commutative77.2%
associate-*l*77.2%
Simplified77.2%
Taylor expanded in K around 0 94.9%
Taylor expanded in m around 0 78.8%
+-commutative78.8%
unpow278.8%
distribute-rgt-out83.7%
*-commutative83.7%
*-commutative83.7%
Simplified83.7%
Final simplification86.7%
(FPCore (K m n M l) :precision binary64 (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 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 = 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.exp(((Math.abs((m - n)) - l) - Math.pow((((m + n) / 2.0) - M), 2.0)));
}
def code(K, m, n, M, l): return math.exp(((math.fabs((m - n)) - l) - math.pow((((m + n) / 2.0) - M), 2.0)))
function code(K, m, n, M, l) return 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 = exp(((abs((m - n)) - l) - ((((m + n) / 2.0) - M) ^ 2.0))); end
code[K_, m_, n_, M_, l_] := 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]
\begin{array}{l}
\\
e^{\left(\left|m - n\right| - \ell\right) - {\left(\frac{m + n}{2} - M\right)}^{2}}
\end{array}
Initial program 78.0%
Taylor expanded in M around 0 78.0%
*-commutative78.0%
*-commutative78.0%
associate-*l*78.0%
Simplified78.0%
Taylor expanded in K around 0 95.9%
Final simplification95.9%
(FPCore (K m n M l)
:precision binary64
(let* ((t_0 (- M (* n 0.5))))
(if (<= m -5e+51)
(* (cos M) (exp (- m (+ n l))))
(exp (- (- (fabs (- m n)) l) (* t_0 (- t_0 m)))))))
double code(double K, double m, double n, double M, double l) {
double t_0 = M - (n * 0.5);
double tmp;
if (m <= -5e+51) {
tmp = cos(M) * exp((m - (n + l)));
} else {
tmp = exp(((fabs((m - n)) - l) - (t_0 * (t_0 - 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) :: t_0
real(8) :: tmp
t_0 = m_1 - (n * 0.5d0)
if (m <= (-5d+51)) then
tmp = cos(m_1) * exp((m - (n + l)))
else
tmp = exp(((abs((m - n)) - l) - (t_0 * (t_0 - m))))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double t_0 = M - (n * 0.5);
double tmp;
if (m <= -5e+51) {
tmp = Math.cos(M) * Math.exp((m - (n + l)));
} else {
tmp = Math.exp(((Math.abs((m - n)) - l) - (t_0 * (t_0 - m))));
}
return tmp;
}
def code(K, m, n, M, l): t_0 = M - (n * 0.5) tmp = 0 if m <= -5e+51: tmp = math.cos(M) * math.exp((m - (n + l))) else: tmp = math.exp(((math.fabs((m - n)) - l) - (t_0 * (t_0 - m)))) return tmp
function code(K, m, n, M, l) t_0 = Float64(M - Float64(n * 0.5)) tmp = 0.0 if (m <= -5e+51) tmp = Float64(cos(M) * exp(Float64(m - Float64(n + l)))); else tmp = exp(Float64(Float64(abs(Float64(m - n)) - l) - Float64(t_0 * Float64(t_0 - m)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) t_0 = M - (n * 0.5); tmp = 0.0; if (m <= -5e+51) tmp = cos(M) * exp((m - (n + l))); else tmp = exp(((abs((m - n)) - l) - (t_0 * (t_0 - m)))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := Block[{t$95$0 = N[(M - N[(n * 0.5), $MachinePrecision]), $MachinePrecision]}, If[LessEqual[m, -5e+51], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision] - N[(t$95$0 * N[(t$95$0 - m), $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]]
\begin{array}{l}
\\
\begin{array}{l}
t_0 := M - n \cdot 0.5\\
\mathbf{if}\;m \leq -5 \cdot 10^{+51}:\\
\;\;\;\;\cos M \cdot e^{m - \left(n + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;e^{\left(\left|m - n\right| - \ell\right) - t\_0 \cdot \left(t\_0 - m\right)}\\
\end{array}
\end{array}
if m < -5e51Initial program 78.6%
*-un-lft-identity78.6%
*-commutative78.6%
Applied egg-rr8.3%
Taylor expanded in l around inf 71.5%
neg-mul-171.5%
Simplified71.5%
Taylor expanded in K around 0 88.2%
cos-neg88.2%
Simplified88.2%
if -5e51 < m Initial program 77.8%
Taylor expanded in M around 0 77.8%
*-commutative77.8%
*-commutative77.8%
associate-*l*77.8%
Simplified77.8%
Taylor expanded in K around 0 95.0%
Taylor expanded in m around 0 79.4%
+-commutative79.4%
unpow279.4%
distribute-rgt-out84.1%
*-commutative84.1%
*-commutative84.1%
Simplified84.1%
Final simplification84.8%
(FPCore (K m n M l) :precision binary64 (if (<= n 1.95) (exp (+ (* (- (* m 0.5) M) (- (- M (* m 0.5)) n)) (- (fabs (- m n)) l))) (* (cos M) (exp (- m (+ n l))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 1.95) {
tmp = exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (fabs((m - n)) - l)));
} else {
tmp = cos(M) * exp((m - (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 (n <= 1.95d0) then
tmp = exp(((((m * 0.5d0) - m_1) * ((m_1 - (m * 0.5d0)) - n)) + (abs((m - n)) - l)))
else
tmp = cos(m_1) * exp((m - (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 (n <= 1.95) {
tmp = Math.exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (Math.abs((m - n)) - l)));
} else {
tmp = Math.cos(M) * Math.exp((m - (n + l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 1.95: tmp = math.exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (math.fabs((m - n)) - l))) else: tmp = math.cos(M) * math.exp((m - (n + l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 1.95) tmp = exp(Float64(Float64(Float64(Float64(m * 0.5) - M) * Float64(Float64(M - Float64(m * 0.5)) - n)) + Float64(abs(Float64(m - n)) - l))); else tmp = Float64(cos(M) * exp(Float64(m - Float64(n + l)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 1.95) tmp = exp(((((m * 0.5) - M) * ((M - (m * 0.5)) - n)) + (abs((m - n)) - l))); else tmp = cos(M) * exp((m - (n + l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 1.95], N[Exp[N[(N[(N[(N[(m * 0.5), $MachinePrecision] - M), $MachinePrecision] * N[(N[(M - N[(m * 0.5), $MachinePrecision]), $MachinePrecision] - n), $MachinePrecision]), $MachinePrecision] + N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 1.95:\\
\;\;\;\;e^{\left(m \cdot 0.5 - M\right) \cdot \left(\left(M - m \cdot 0.5\right) - n\right) + \left(\left|m - n\right| - \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{m - \left(n + \ell\right)}\\
\end{array}
\end{array}
if n < 1.94999999999999996Initial program 82.4%
Taylor expanded in M around 0 82.4%
*-commutative82.4%
*-commutative82.4%
associate-*l*82.4%
Simplified82.4%
Taylor expanded in K around 0 95.5%
Taylor expanded in n around 0 81.4%
+-commutative81.4%
unpow281.4%
distribute-rgt-out83.6%
*-commutative83.6%
*-commutative83.6%
Simplified83.6%
if 1.94999999999999996 < n Initial program 65.2%
*-un-lft-identity65.2%
*-commutative65.2%
Applied egg-rr5.5%
Taylor expanded in l around inf 54.7%
neg-mul-154.7%
Simplified54.7%
Taylor expanded in K around 0 82.1%
cos-neg82.1%
Simplified82.1%
Final simplification83.2%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- m (+ n l)))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((m - (n + 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((m - (n + l)))
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)));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((m - (n + l)))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(m - Float64(n + l)))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((m - (n + l))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{m - \left(n + \ell\right)}
\end{array}
Initial program 78.0%
*-un-lft-identity78.0%
*-commutative78.0%
Applied egg-rr19.2%
Taylor expanded in l around inf 44.3%
neg-mul-144.3%
Simplified44.3%
Taylor expanded in K around 0 53.4%
cos-neg53.4%
Simplified53.4%
Final simplification53.4%
(FPCore (K m n M l) :precision binary64 (* (cos M) (exp (- m l))))
double code(double K, double m, double n, double M, double l) {
return cos(M) * exp((m - 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((m - l))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.cos(M) * Math.exp((m - l));
}
def code(K, m, n, M, l): return math.cos(M) * math.exp((m - l))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(m - l))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((m - l)); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(m - l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{m - \ell}
\end{array}
Initial program 78.0%
*-un-lft-identity78.0%
*-commutative78.0%
Applied egg-rr19.2%
Taylor expanded in l around inf 44.3%
neg-mul-144.3%
Simplified44.3%
Taylor expanded in m around 0 46.3%
*-commutative46.3%
associate-*l*46.3%
Simplified46.3%
Taylor expanded in n around 0 45.2%
cos-neg45.2%
Simplified45.2%
herbie shell --seed 2024101
(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)))))))