
(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) 0.5) 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) * 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((abs((m - n)) - (l + ((((m + n) * 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((Math.abs((m - n)) - (l + Math.pow((((m + n) * 0.5) - 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) * 0.5) - M), 2.0))))
function code(K, m, n, M, l) return Float64(cos(M) * exp(Float64(abs(Float64(m - n)) - Float64(l + (Float64(Float64(Float64(m + n) * 0.5) - M) ^ 2.0))))) end
function tmp = code(K, m, n, M, l) tmp = cos(M) * exp((abs((m - n)) - (l + ((((m + n) * 0.5) - M) ^ 2.0)))); end
code[K_, m_, n_, M_, l_] := N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Abs[N[(m - n), $MachinePrecision]], $MachinePrecision] - N[(l + N[Power[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] - M), $MachinePrecision], 2.0], $MachinePrecision]), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]
\begin{array}{l}
\\
\cos M \cdot e^{\left|m - n\right| - \left(\ell + {\left(\left(m + n\right) \cdot 0.5 - M\right)}^{2}\right)}
\end{array}
Initial program 74.4%
Taylor expanded in K around 0 96.8%
cos-neg96.8%
associate--r+96.8%
*-commutative96.8%
associate--r+96.8%
Simplified96.8%
Final simplification96.8%
(FPCore (K m n M l) :precision binary64 (if (<= n 126.0) (* (cos (- (* 0.5 (* n K)) M)) (exp (- (- (- m n) (pow M 2.0)) l))) (* (cos M) (exp (* (pow n 2.0) -0.25)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 126.0) {
tmp = cos(((0.5 * (n * K)) - M)) * exp((((m - n) - pow(M, 2.0)) - l));
} else {
tmp = cos(M) * exp((pow(n, 2.0) * -0.25));
}
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 <= 126.0d0) then
tmp = cos(((0.5d0 * (n * k)) - m_1)) * exp((((m - n) - (m_1 ** 2.0d0)) - l))
else
tmp = cos(m_1) * exp(((n ** 2.0d0) * (-0.25d0)))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if (n <= 126.0) {
tmp = Math.cos(((0.5 * (n * K)) - M)) * Math.exp((((m - n) - Math.pow(M, 2.0)) - l));
} else {
tmp = Math.cos(M) * Math.exp((Math.pow(n, 2.0) * -0.25));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if n <= 126.0: tmp = math.cos(((0.5 * (n * K)) - M)) * math.exp((((m - n) - math.pow(M, 2.0)) - l)) else: tmp = math.cos(M) * math.exp((math.pow(n, 2.0) * -0.25)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (n <= 126.0) tmp = Float64(cos(Float64(Float64(0.5 * Float64(n * K)) - M)) * exp(Float64(Float64(Float64(m - n) - (M ^ 2.0)) - l))); else tmp = Float64(cos(M) * exp(Float64((n ^ 2.0) * -0.25))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (n <= 126.0) tmp = cos(((0.5 * (n * K)) - M)) * exp((((m - n) - (M ^ 2.0)) - l)); else tmp = cos(M) * exp(((n ^ 2.0) * -0.25)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[n, 126.0], N[(N[Cos[N[(N[(0.5 * N[(n * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[(m - n), $MachinePrecision] - N[Power[M, 2.0], $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[N[(N[Power[n, 2.0], $MachinePrecision] * -0.25), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;n \leq 126:\\
\;\;\;\;\cos \left(0.5 \cdot \left(n \cdot K\right) - M\right) \cdot e^{\left(\left(m - n\right) - {M}^{2}\right) - \ell}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{{n}^{2} \cdot -0.25}\\
\end{array}
\end{array}
if n < 126Initial program 77.6%
Taylor expanded in m around 0 58.7%
+-commutative58.7%
unpow258.7%
distribute-rgt-out59.8%
*-commutative59.8%
*-commutative59.8%
Simplified59.8%
Taylor expanded in n around 0 50.2%
associate--r+50.2%
associate-*r*50.2%
neg-mul-150.2%
cancel-sign-sub50.2%
Simplified50.2%
Taylor expanded in m around 0 57.4%
mul-1-neg57.4%
unsub-neg57.4%
fabs-sub57.4%
sub-neg57.4%
mul-1-neg57.4%
fabs-neg57.4%
fabs-neg57.4%
mul-1-neg57.4%
sub-neg57.4%
fabs-sub57.4%
rem-square-sqrt33.9%
fabs-sqr33.9%
rem-square-sqrt67.5%
Simplified67.5%
if 126 < n Initial program 64.5%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in n around inf 98.4%
*-commutative98.4%
Simplified98.4%
Final simplification75.0%
(FPCore (K m n M l) :precision binary64 (if (<= M 38.0) (exp (- m (+ n l))) (* (cos M) (exp (- (pow M 2.0))))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (M <= 38.0) {
tmp = exp((m - (n + l)));
} else {
tmp = cos(M) * exp(-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_1 <= 38.0d0) then
tmp = exp((m - (n + l)))
else
tmp = cos(m_1) * exp(-(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 <= 38.0) {
tmp = Math.exp((m - (n + l)));
} else {
tmp = Math.cos(M) * Math.exp(-Math.pow(M, 2.0));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if M <= 38.0: tmp = math.exp((m - (n + l))) else: tmp = math.cos(M) * math.exp(-math.pow(M, 2.0)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (M <= 38.0) tmp = exp(Float64(m - Float64(n + l))); else tmp = Float64(cos(M) * exp(Float64(-(M ^ 2.0)))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (M <= 38.0) tmp = exp((m - (n + l))); else tmp = cos(M) * exp(-(M ^ 2.0)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[M, 38.0], N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[M], $MachinePrecision] * N[Exp[(-N[Power[M, 2.0], $MachinePrecision])], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;M \leq 38:\\
\;\;\;\;e^{m - \left(n + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos M \cdot e^{-{M}^{2}}\\
\end{array}
\end{array}
if M < 38Initial program 72.6%
Taylor expanded in m around 0 54.3%
+-commutative54.3%
unpow254.3%
distribute-rgt-out55.3%
*-commutative55.3%
*-commutative55.3%
Simplified55.3%
Taylor expanded in n around 0 39.0%
associate--r+39.0%
associate-*r*39.0%
neg-mul-139.0%
cancel-sign-sub39.0%
Simplified39.0%
Taylor expanded in M around 0 23.2%
associate-*r*23.2%
Simplified23.2%
Taylor expanded in K around 0 26.6%
div-exp19.4%
sub-neg19.4%
mul-1-neg19.4%
mul-1-neg19.4%
remove-double-neg19.4%
mul-1-neg19.4%
distribute-neg-in19.4%
+-commutative19.4%
exp-diff26.6%
fabs-neg26.6%
mul-1-neg26.6%
sub-neg26.6%
fabs-sub26.6%
rem-square-sqrt14.3%
fabs-sqr14.3%
rem-square-sqrt61.2%
Simplified61.2%
if 38 < M Initial program 80.7%
Taylor expanded in K around 0 100.0%
cos-neg100.0%
associate--r+100.0%
*-commutative100.0%
associate--r+100.0%
Simplified100.0%
Taylor expanded in M around inf 100.0%
mul-1-neg100.0%
Simplified100.0%
Final simplification69.9%
(FPCore (K m n M l)
:precision binary64
(if (or (<= K -2.8e+31) (not (<= K 11000000000.0)))
(exp (- m (+ n l)))
(*
(cos (- (* (+ m n) (* 0.5 K)) M))
(exp (- (+ (- m n) (* M (- m M))) l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if ((K <= -2.8e+31) || !(K <= 11000000000.0)) {
tmp = exp((m - (n + l)));
} else {
tmp = cos((((m + n) * (0.5 * K)) - M)) * exp((((m - n) + (M * (m - M))) - 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 ((k <= (-2.8d+31)) .or. (.not. (k <= 11000000000.0d0))) then
tmp = exp((m - (n + l)))
else
tmp = cos((((m + n) * (0.5d0 * k)) - m_1)) * exp((((m - n) + (m_1 * (m - m_1))) - l))
end if
code = tmp
end function
public static double code(double K, double m, double n, double M, double l) {
double tmp;
if ((K <= -2.8e+31) || !(K <= 11000000000.0)) {
tmp = Math.exp((m - (n + l)));
} else {
tmp = Math.cos((((m + n) * (0.5 * K)) - M)) * Math.exp((((m - n) + (M * (m - M))) - l));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if (K <= -2.8e+31) or not (K <= 11000000000.0): tmp = math.exp((m - (n + l))) else: tmp = math.cos((((m + n) * (0.5 * K)) - M)) * math.exp((((m - n) + (M * (m - M))) - l)) return tmp
function code(K, m, n, M, l) tmp = 0.0 if ((K <= -2.8e+31) || !(K <= 11000000000.0)) tmp = exp(Float64(m - Float64(n + l))); else tmp = Float64(cos(Float64(Float64(Float64(m + n) * Float64(0.5 * K)) - M)) * exp(Float64(Float64(Float64(m - n) + Float64(M * Float64(m - M))) - l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if ((K <= -2.8e+31) || ~((K <= 11000000000.0))) tmp = exp((m - (n + l))); else tmp = cos((((m + n) * (0.5 * K)) - M)) * exp((((m - n) + (M * (m - M))) - l)); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[Or[LessEqual[K, -2.8e+31], N[Not[LessEqual[K, 11000000000.0]], $MachinePrecision]], N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision], N[(N[Cos[N[(N[(N[(m + n), $MachinePrecision] * N[(0.5 * K), $MachinePrecision]), $MachinePrecision] - M), $MachinePrecision]], $MachinePrecision] * N[Exp[N[(N[(N[(m - n), $MachinePrecision] + N[(M * N[(m - M), $MachinePrecision]), $MachinePrecision]), $MachinePrecision] - l), $MachinePrecision]], $MachinePrecision]), $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;K \leq -2.8 \cdot 10^{+31} \lor \neg \left(K \leq 11000000000\right):\\
\;\;\;\;e^{m - \left(n + \ell\right)}\\
\mathbf{else}:\\
\;\;\;\;\cos \left(\left(m + n\right) \cdot \left(0.5 \cdot K\right) - M\right) \cdot e^{\left(\left(m - n\right) + M \cdot \left(m - M\right)\right) - \ell}\\
\end{array}
\end{array}
if K < -2.80000000000000017e31 or 1.1e10 < K Initial program 46.7%
Taylor expanded in m around 0 36.3%
+-commutative36.3%
unpow236.3%
distribute-rgt-out37.1%
*-commutative37.1%
*-commutative37.1%
Simplified37.1%
Taylor expanded in n around 0 29.9%
associate--r+29.9%
associate-*r*29.9%
neg-mul-129.9%
cancel-sign-sub29.9%
Simplified29.9%
Taylor expanded in M around 0 18.0%
associate-*r*18.0%
Simplified18.0%
Taylor expanded in K around 0 25.3%
div-exp14.5%
sub-neg14.5%
mul-1-neg14.5%
mul-1-neg14.5%
remove-double-neg14.5%
mul-1-neg14.5%
distribute-neg-in14.5%
+-commutative14.5%
exp-diff25.3%
fabs-neg25.3%
mul-1-neg25.3%
sub-neg25.3%
fabs-sub25.3%
rem-square-sqrt15.6%
fabs-sqr15.6%
rem-square-sqrt58.9%
Simplified58.9%
if -2.80000000000000017e31 < K < 1.1e10Initial program 100.0%
Taylor expanded in m around 0 77.7%
+-commutative77.7%
unpow277.7%
distribute-rgt-out79.3%
*-commutative79.3%
*-commutative79.3%
Simplified79.3%
Taylor expanded in n around 0 60.0%
associate--r+60.0%
associate-*r*60.0%
neg-mul-160.0%
cancel-sign-sub60.0%
Simplified60.0%
Taylor expanded in m around -inf 60.0%
associate-*r*60.0%
fmm-def60.0%
sub-neg60.0%
mul-1-neg60.0%
remove-double-neg60.0%
+-commutative60.0%
fmm-def60.0%
Simplified77.1%
Final simplification68.3%
(FPCore (K m n M l) :precision binary64 (if (<= l -5.5e+222) (* (exp (- m n)) (cos (* (* (+ m n) 0.5) K))) (exp (- m (+ n l)))))
double code(double K, double m, double n, double M, double l) {
double tmp;
if (l <= -5.5e+222) {
tmp = exp((m - n)) * cos((((m + n) * 0.5) * K));
} else {
tmp = 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 (l <= (-5.5d+222)) then
tmp = exp((m - n)) * cos((((m + n) * 0.5d0) * k))
else
tmp = 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 (l <= -5.5e+222) {
tmp = Math.exp((m - n)) * Math.cos((((m + n) * 0.5) * K));
} else {
tmp = Math.exp((m - (n + l)));
}
return tmp;
}
def code(K, m, n, M, l): tmp = 0 if l <= -5.5e+222: tmp = math.exp((m - n)) * math.cos((((m + n) * 0.5) * K)) else: tmp = math.exp((m - (n + l))) return tmp
function code(K, m, n, M, l) tmp = 0.0 if (l <= -5.5e+222) tmp = Float64(exp(Float64(m - n)) * cos(Float64(Float64(Float64(m + n) * 0.5) * K))); else tmp = exp(Float64(m - Float64(n + l))); end return tmp end
function tmp_2 = code(K, m, n, M, l) tmp = 0.0; if (l <= -5.5e+222) tmp = exp((m - n)) * cos((((m + n) * 0.5) * K)); else tmp = exp((m - (n + l))); end tmp_2 = tmp; end
code[K_, m_, n_, M_, l_] := If[LessEqual[l, -5.5e+222], N[(N[Exp[N[(m - n), $MachinePrecision]], $MachinePrecision] * N[Cos[N[(N[(N[(m + n), $MachinePrecision] * 0.5), $MachinePrecision] * K), $MachinePrecision]], $MachinePrecision]), $MachinePrecision], N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]]
\begin{array}{l}
\\
\begin{array}{l}
\mathbf{if}\;\ell \leq -5.5 \cdot 10^{+222}:\\
\;\;\;\;e^{m - n} \cdot \cos \left(\left(\left(m + n\right) \cdot 0.5\right) \cdot K\right)\\
\mathbf{else}:\\
\;\;\;\;e^{m - \left(n + \ell\right)}\\
\end{array}
\end{array}
if l < -5.4999999999999999e222Initial program 81.8%
Taylor expanded in m around 0 45.9%
+-commutative45.9%
unpow245.9%
distribute-rgt-out55.0%
*-commutative55.0%
*-commutative55.0%
Simplified55.0%
Taylor expanded in n around 0 63.9%
associate--r+63.9%
associate-*r*63.9%
neg-mul-163.9%
cancel-sign-sub63.9%
Simplified63.9%
Taylor expanded in M around 0 19.2%
associate-*r*19.2%
Simplified19.2%
Taylor expanded in l around 0 10.5%
Simplified46.3%
if -5.4999999999999999e222 < l Initial program 74.1%
Taylor expanded in m around 0 58.4%
+-commutative58.4%
unpow258.4%
distribute-rgt-out59.2%
*-commutative59.2%
*-commutative59.2%
Simplified59.2%
Taylor expanded in n around 0 44.7%
associate--r+44.7%
associate-*r*44.7%
neg-mul-144.7%
cancel-sign-sub44.7%
Simplified44.7%
Taylor expanded in M around 0 21.1%
associate-*r*21.1%
Simplified21.1%
Taylor expanded in K around 0 24.8%
div-exp17.7%
sub-neg17.7%
mul-1-neg17.7%
mul-1-neg17.7%
remove-double-neg17.7%
mul-1-neg17.7%
distribute-neg-in17.7%
+-commutative17.7%
exp-diff24.8%
fabs-neg24.8%
mul-1-neg24.8%
sub-neg24.8%
fabs-sub24.8%
rem-square-sqrt13.9%
fabs-sqr13.9%
rem-square-sqrt58.9%
Simplified58.9%
Final simplification58.4%
(FPCore (K m n M l) :precision binary64 (exp (- m (+ n l))))
double code(double K, double m, double n, double M, double l) {
return 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 = exp((m - (n + l)))
end function
public static double code(double K, double m, double n, double M, double l) {
return Math.exp((m - (n + l)));
}
def code(K, m, n, M, l): return math.exp((m - (n + l)))
function code(K, m, n, M, l) return exp(Float64(m - Float64(n + l))) end
function tmp = code(K, m, n, M, l) tmp = exp((m - (n + l))); end
code[K_, m_, n_, M_, l_] := N[Exp[N[(m - N[(n + l), $MachinePrecision]), $MachinePrecision]], $MachinePrecision]
\begin{array}{l}
\\
e^{m - \left(n + \ell\right)}
\end{array}
Initial program 74.4%
Taylor expanded in m around 0 57.8%
+-commutative57.8%
unpow257.8%
distribute-rgt-out59.0%
*-commutative59.0%
*-commutative59.0%
Simplified59.0%
Taylor expanded in n around 0 45.6%
associate--r+45.6%
associate-*r*45.6%
neg-mul-145.6%
cancel-sign-sub45.6%
Simplified45.6%
Taylor expanded in M around 0 21.0%
associate-*r*21.0%
Simplified21.0%
Taylor expanded in K around 0 24.6%
div-exp17.7%
sub-neg17.7%
mul-1-neg17.7%
mul-1-neg17.7%
remove-double-neg17.7%
mul-1-neg17.7%
distribute-neg-in17.7%
+-commutative17.7%
exp-diff24.6%
fabs-neg24.6%
mul-1-neg24.6%
sub-neg24.6%
fabs-sub24.6%
rem-square-sqrt13.7%
fabs-sqr13.7%
rem-square-sqrt57.2%
Simplified57.2%
Final simplification57.2%
(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 74.4%
Taylor expanded in l around inf 28.8%
mul-1-neg28.8%
Simplified28.8%
Taylor expanded in M around 0 28.8%
*-commutative28.8%
associate-*r*28.8%
*-lft-identity28.8%
metadata-eval28.8%
cancel-sign-sub-inv28.8%
associate-*r*28.8%
*-commutative28.8%
sub-neg28.8%
mul-1-neg28.8%
remove-double-neg28.8%
+-commutative28.8%
Simplified28.8%
Taylor expanded in K around 0 36.7%
Final simplification36.7%
herbie shell --seed 2024109
(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)))))))